body {
  margin: 0;
  background: #cce7ff;
  font-family: sans-serif;
}

/* 顶部 header（固定在顶部）- 修改居中方式 */
.header {
  height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  border-bottom: 1px solid #ccc;
  background-color: #fff;
  width: 98%;
  border-radius: 4px;
  z-index: 1000;
  box-sizing: border-box;
}

.title {
  font-size: 22px;
  font-weight: bold;
}

/* 搜索框 */
.search-box {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 10em;
  height: 2em;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0 0.5em;
  outline: none;
  font-size: 14px;
}

.search-box input::placeholder {
  color: #999;
}

.search-box button {
  margin-left: 0.3em;
  height: 2em;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

/* 给 roomList 让出 header 和联赛栏的高度 - 【修改】原6em改为9em，增加sportBar高度 */
#roomList {
  padding-top: 8.7em;
}

/* 房间框 - 修改为固定高度，内部使用容器 */
.block {
  height: 4em;
  width: 98%;
  margin: 0.5em auto;
  background-color: #fff;
  border-radius: 4px;
  cursor: pointer;
  box-sizing: border-box;
  border-bottom: 1px solid #ccc;
}

/* 房间内部容器 - 使用flex布局实现左中右三列 */
.block-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 10px;
  box-sizing: border-box;
  position: relative;
}

/* 左侧时间 */
.block-time {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #999;
  white-space: nowrap;
  z-index: 1;
}

/* 中间内容区域 - 真正的居中 */
.block-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  margin: 0 auto;
  width: 100%;
  position: relative;
  left: 0;
  right: 0;
}

/* 联赛胶囊 - 基于整个rooms框居中 */
.first-line {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  padding: 0 0.8em;
  height: 1.6em;
  line-height: 1.6em;
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  text-align: center;
  margin: 0 auto 2px auto;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 队伍名称 - 基于整个rooms框居中 */
.match-teams {
  font-size: 16px;
  text-align: center;
  color: #333;
  width: 100%;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 右侧内容区域 */
.block-right {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}

/* 观众人数区域 */
.audience-info {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
  color: #999;
  height: 1.8em;
  line-height: 1.8em;
  font-weight: normal;
  white-space: nowrap;
  padding: 0;
}

/* 小人图标 - 使用img标签 */
.audience-icon {
  width: 12px;
  height: 12px;
  margin-right: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* 观众人数数字 */
.audience-count {
  font-size: 11px;
  color: #999;
  font-weight: normal;
  white-space: nowrap;
  flex-shrink: 0;
  vertical-align: middle;
}

/* 右侧图片样式 */
.room-icon {
  width: 24px;
  height: 24px;
}

/* 鼠标 hover 效果 */
.block:hover {
  background-color: #f5f5f5;
}

/* 联赛框 - 【修改】top由3em改为6em，以适应新增的sportBar */
.league-bar {
  width: 98%;
  margin: 0 auto;
  background: #fff;
  border-radius: 4px;
  height: 3em;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: fixed;
  top: 5.8em;
  left: 0;
  right: 0;
  z-index: 999;
  box-sizing: border-box;
}

.league-scroll {
  display: flex;
  gap: 0.6em;
  padding: 0 0.6em;
  overflow-x: auto;
  white-space: nowrap;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.league-scroll::-webkit-scrollbar {
  display: none;
}

.league-btn {
  flex: 0 0 auto;
  padding: 0.45em 0.9em;
  border-radius: 999px;
  background: #d8eaff;
  color: #000;
  border: none;
  font-size: 14px;
  cursor: pointer;
}

/* 用户图标样式 */
.user-icon {
  transition: color 0.3s ease;
  cursor: pointer;
}

.user-icon:hover {
  opacity: 0.8;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ===== 【新增】体育种类框样式（已在index.html内联，此处补充以确保全局统一）===== */
#sportBar {
  position: fixed;
  top: 3em;            /* 紧贴标题栏底部（标题栏高度 3em） */
  left: 0;
  right: 0;
  margin: 0 auto;      /* 水平居中 */
  width: 98%;
  background: #fff;
  border-radius: 4px;
  height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 999;       /* 位于标题栏（z-index:1000）下方，联赛框（z-index:998）上方 */
}
.sport-btn {
  padding: 0.45em 0.9em;
  border-radius: 999px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.sport-btn.active {
  background: #003366;
  color: #fff;
}
.sport-btn:not(.active) {
  background: #d8eaff;
  color: #000;
}

/* 响应式设计 - 【修改】适配sportBar */
@media (max-width: 480px) {
  .header {
    height: 2.8em;
  }
  
  .title {
    font-size: 20px;
  }
  
  .search-box input {
    width: 8em;
  }
  
  #roomList {
    padding-top: 8.7em; /* 2.8 + 2.8 + 2.8 */
  }
  
  .block {
    height: 3.8em;
  }
  
  .block-time {
    left: 8px;
    font-size: 13px;
  }
  
  .first-line {
    font-size: 13px;
    padding: 0 0.6em;
    height: 1.5em;
    line-height: 1.5em;
    margin-bottom: 1px;
  }
  
  .match-teams {
    font-size: 15px;
  }
  
  .audience-info {
    font-size: 10px;
  }
  
  .audience-icon {
    width: 10px;
    height: 10px;
  }
  
  .room-icon {
    width: 22px;
    height: 22px;
  }
  
  .league-bar {
    height: 2.8em;
    top: 5.8em; /* 2.8 + 2.8 */
  }
  
  .league-btn {
    padding: 0.4em 0.8em;
    font-size: 13px;
  }

  #sportBar {
    height: 2.8em;
    top: 3em;
  }
  .sport-btn {
    font-size: 13px;
    padding: 0.4em 0.8em;
  }
}

@media (max-width: 360px) {
  .block-time {
    font-size: 12px;
  }
  
  .first-line {
    font-size: 12px;
  }
  
  .match-teams {
    font-size: 14px;
  }
  
  .audience-count {
    font-size: 10px;
  }
  
  .block-container {
    padding: 0 8px;
  }
  
  .block-right {
    right: 8px;
  }

  .sport-btn {
    font-size: 12px;
    padding: 0.35em 0.7em;
  }
}