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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.topbar {
  background: linear-gradient(135deg, #c92244 0%, #e85d75 100%);
  color: white;
  padding: 20px 30px;
  text-align: center;
}

.topbar h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 5px;
}

.topbar .tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: normal;
}

.table {
  padding: 30px;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

#status {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

#wallInfo {
  font-size: 14px;
  color: #666;
  background: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.battlefield {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  min-height: 500px;
}

.player {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.player.active {
  border-color: #667eea;
  background: #f0f4ff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.player h3 {
  font-size: 16px;
  color: #555;
  margin-bottom: 10px;
}

.player .meta {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
}

.seat-left {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.seat-top {
  grid-column: 2;
  grid-row: 1;
}

.seat-right {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.discard-area {
  grid-column: 2;
  grid-row: 2;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.discard-area h3 {
  font-size: 16px;
  color: #555;
  margin-bottom: 10px;
}

.pile {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  max-height: 200px;
  overflow-y: auto;
}

.self-area {
  grid-column: 2;
  grid-row: 3;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  padding: 20px;
  color: white;
}

.self-area h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.hint {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 15px;
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.action-bar button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-bar button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#newGameBtn {
  background: #4CAF50;
  color: white;
}

#newGameBtn:hover {
  background: #45a049;
}

#tenpaiModeBtn {
  background: #2196F3;
  color: white;
}

#tenpaiModeBtn.mode-on {
  background: #1976D2;
}

#pengBtn, #kongBtn, #huBtn {
  background: #FF9800;
  color: white;
}

#passBtn {
  background: #9E9E9E;
  color: white;
}

.advisor {
  background: rgba(255, 255, 255, 0.1);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 14px;
  border-left: 4px solid #FF9800;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 100px;
}

.tile {
  width: 50px;
  height: 70px;
  background: #fff;
  border: 2px solid #333;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  user-select: none;
  overflow: hidden;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tile:hover {
  transform: translateY(-5px);
  box-shadow: 4px 6px 12px rgba(0, 0, 0, 0.3);
  border-color: #667eea;
}

.tile.self {
  cursor: pointer;
}

.tile.recommend {
  animation: pulse 1.5s ease-in-out infinite;
  border-color: #FF9800;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.ai-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.ai-hand .tile {
  width: 30px;
  height: 42px;
  font-size: 24px;
  opacity: 0.7;
}

.discard-item {
  position: relative;
  display: inline-block;
  margin: 2px;
}

.discard-owner {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #666;
  background: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.log-panel {
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  padding: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.log-panel h3 {
  font-size: 16px;
  color: #555;
  margin-bottom: 10px;
}

#log {
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
}

#log div {
  padding: 4px 0;
  border-bottom: 1px solid #e0e0e0;
}

#log div:last-child {
  border-bottom: none;
}

.log-peng {
  color: #FF9800;
  font-weight: 600;
}

.log-kong {
  color: #9C27B0;
  font-weight: 600;
}

.log-hu {
  color: #c92244;
  font-weight: 700;
  font-size: 14px;
}

.log-discard {
  color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .battlefield {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .seat-left, .seat-top, .seat-right {
    grid-column: 1;
    grid-row: auto;
  }

  .tile {
    width: 40px;
    height: 56px;
    font-size: 32px;
  }

  .topbar h1 {
    font-size: 22px;
  }
}
