body {
  margin: 0;
  font-family: "微軟正黑體", sans-serif;
  background: #f4e2c9;
}

header {
  background-color: #a05c2f;
  color: white;
  padding: 1rem;
  text-align: center;
  font-size: 1.5rem;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
}

.main {
  display: flex;
  flex: 1;
  min-height: 0; /* 防止內容溢出 */
  overflow: hidden;
}

.room-list {
  flex: 2;
  overflow-y: auto;
  background: #fff3e0;
  padding: 1rem;
  min-height: 0; /* 允許內容在需要時收縮 */
}

.room {
  background: #fff;
  border: 2px solid #cfa77f;
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 1rem;
}

.room-title {
  font-weight: bold;
  font-size: 1.1rem;
}

.room-status {
  font-size: 0.9rem;
  color: #555;
}

.sidebar {
  background: #ffefc0;
  padding: 1rem;
  border-left: 2px solid #cfa77f;
}

.player-info {
  text-align: center;
}

.chat-area {
  height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cfa77f;
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem;
  font-size: 14px;
}

.chat-input-container {
  display: flex;
  gap: 8px;
  padding: 0 1rem;
  margin-bottom: 1rem;
  align-items: center;
}

.chat-input-container input {
  flex: 1;
  padding: 8px;
  border: 1px solid #cfa77f;
  border-radius: 4px;
  font-size: 14px;
}

.chat-input-container button {
  padding: 8px 16px;
  background: #a05c2f;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.chat-input-container button:hover {
  background: #7a4523;
}

.chat-message {
  margin: 4px 0;
  line-height: 1.4;
}

.chat-system {
  margin: 4px 0;
  color: #666;
  font-style: italic;
}

.time {
  color: #999;
  font-size: 12px;
  margin-right: 4px;
}

.footer {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: #a05c2f;
  position: sticky; /* 確保按鈕始終可見 */
  bottom: 0;
}

.footer button {
  flex: 1;
  margin: 0 0.5rem;
  padding: 0.75rem;
  border: none;
  background: #f8d59b;
  font-size: 1rem;
  font-weight: bold;
  border-radius: 8px;
}

.message-type {
  padding: 8px;
  border: 1px solid #cfa77f;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.private-target {
  padding: 8px;
  border: 1px solid #cfa77f;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.private-message {
  background-color: #fff3e0;
  padding: 4px 8px;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .main {
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .sidebar {
    border-left: none;
    border-top: 2px solid #cfa77f;
    padding: 0.5rem; /* 減少側邊欄內邊距 */
  }

  .room-list {
    flex: 1;
    max-height: calc(100vh - 280px); /* 限制最大高度 */
  }

  .player-info {
    margin: 0.5rem 0;
  }

  .chat-area {
    height: 150px;
    margin: 0.5rem;
  }
  
  .chat-input-container {
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
  }
  
  .message-type,
  .private-target {
    flex: 1;
    min-width: 100px;
  }
}

