.groups-page {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--warm-text);
  background: #0b211e;
}

.groups-background {
  position: fixed;
  z-index: -2;
  inset: 0;
  background: linear-gradient(135deg, rgba(6, 18, 16, 0.76), rgba(14, 45, 38, 0.42)), url("assets/warm-study-background.jpg") center / cover;
}

.groups-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(6, 20, 17, 0.3);
}

.groups-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.groups-main {
  width: min(1380px, calc(100% - 64px));
  margin: 0 auto;
  padding: 128px 0 72px;
}

.people-section {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 0 2px 12px;
}

.section-heading p,
.conversation-section h2,
.chat-heading small {
  margin: 0;
  color: rgba(255, 246, 232, 0.48);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.section-heading h1 {
  margin: 6px 0 0;
  color: var(--warm-text);
  font-family: "STZhongsong", "华文中宋", "STSong", "SimSun", serif;
  font-size: 30px;
  font-weight: 700;
}

.people-count {
  padding-bottom: 3px;
  color: rgba(255, 246, 232, 0.48);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 11px;
}

.people-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.person-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255, 246, 232, 0.2);
  border-radius: 10px;
  background: rgba(7, 24, 21, 0.7);
  box-shadow: 0 16px 32px rgba(1, 11, 9, 0.14);
  transition: transform 0.28s var(--ease-quiet), background 0.28s var(--ease-quiet);
}

.person-card:hover {
  background: rgba(16, 47, 39, 0.82);
  transform: translateY(-2px);
}

.person-avatar,
.conversation-avatar,
.chat-avatar,
.chat-avatar-image {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--warm-text);
  background: rgba(232, 242, 235, 0.16);
  font-family: "STKaiti", "KaiTi", serif;
}

.person-avatar {
  width: 46px;
  height: 46px;
  font-size: 18px;
}

.person-avatar img,
.conversation-avatar img,
.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-goal {
  display: -webkit-box;
  grid-column: 2;
  margin: 0;
  overflow: hidden;
  color: rgba(255, 246, 232, 0.88);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.person-tags {
  display: flex;
  grid-column: 2;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: -6px;
}

.people-tag {
  padding: 3px 7px;
  border-radius: 4px;
  color: rgba(255, 246, 232, 0.58);
  background: rgba(255, 255, 255, 0.07);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 9px;
  line-height: 1.2;
}

.person-actions {
  display: grid;
  grid-column: 3;
  grid-row: 1 / span 2;
  gap: 7px;
}

.person-action {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 246, 232, 0.7);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color 0.2s var(--ease-quiet), background 0.2s var(--ease-quiet);
}

.person-action:hover,
.person-action.is-active {
  color: #17332c;
  background: rgba(255, 246, 232, 0.86);
}

.people-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 22px;
  color: rgba(255, 246, 232, 0.56);
  background: rgba(7, 24, 21, 0.62);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  text-align: center;
}

.messenger {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid rgba(255, 246, 232, 0.24);
  border-radius: 13px;
  background: rgba(8, 25, 22, 0.9);
  box-shadow: 0 28px 58px rgba(1, 11, 9, 0.26);
}

.conversation-sidebar {
  min-height: 0;
  padding: 16px 12px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.045);
}

.conversation-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.09);
}

.conversation-search span {
  color: rgba(255, 246, 232, 0.48);
  font-size: 22px;
  line-height: 1;
}

.conversation-search input,
.chat-form input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--warm-text);
  background: transparent;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 12px;
}

.conversation-search input::placeholder,
.chat-form input::placeholder {
  color: rgba(255, 246, 232, 0.38);
}

.conversation-section {
  margin-top: 21px;
}

.conversation-section h2 {
  padding: 0 6px 8px;
}

.joined-room-section {
  padding-top: 17px;
  border-top: 1px solid rgba(255, 246, 232, 0.11);
}

.conversation-list {
  display: grid;
}

.conversation-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px 7px;
  border: 0;
  border-bottom: 1px solid rgba(255, 246, 232, 0.08);
  color: var(--warm-text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s var(--ease-quiet);
}

.conversation-row:hover,
.conversation-row.is-selected {
  background: rgba(255, 255, 255, 0.11);
}

.conversation-avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.conversation-copy {
  min-width: 0;
}

.conversation-copy strong,
.conversation-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-copy strong {
  color: rgba(255, 246, 232, 0.88);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 15px;
  font-weight: 400;
}

.conversation-copy small {
  margin-top: 3px;
  color: rgba(255, 246, 232, 0.42);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 10px;
}

.conversation-empty {
  margin: 9px 7px 0;
  color: rgba(255, 246, 232, 0.4);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 12px;
  line-height: 1.7;
}

.message-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(5, 17, 15, 0.4);
}

.chat-empty {
  display: grid;
  flex: 1;
  place-content: center;
  gap: 10px;
  padding: 30px;
  color: rgba(255, 246, 232, 0.42);
  font-family: "STKaiti", "KaiTi", serif;
  text-align: center;
}

.chat-empty span {
  font-size: 30px;
}

.chat-empty p {
  margin: 0;
  font-size: 15px;
}

.chat-window {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.chat-window[hidden] {
  display: none;
}

.chat-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 246, 232, 0.13);
}

.chat-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 14px;
}

.chat-heading strong {
  display: block;
  color: var(--warm-text);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 18px;
  font-weight: 400;
}

.chat-heading small {
  display: block;
  margin-top: 2px;
  letter-spacing: 0.05em;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  flex: 1;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}

.chat-message {
  display: grid;
  justify-self: start;
  gap: 3px;
  max-width: min(78%, 520px);
  padding: 9px 12px;
  color: rgba(255, 246, 232, 0.82);
  background: rgba(255, 255, 255, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 12px;
  line-height: 1.65;
}

.chat-message small {
  color: rgba(255, 246, 232, 0.48);
  font-size: 9px;
}

.chat-message.is-mine {
  justify-self: end;
  color: #18362f;
  background: rgba(255, 246, 232, 0.84);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  padding: 13px 16px;
  border-top: 1px solid rgba(255, 246, 232, 0.12);
}

.chat-form input {
  min-height: 38px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.07);
}

.chat-form button {
  border: 0;
  color: #17332c;
  background: rgba(255, 246, 232, 0.86);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.2s var(--ease-quiet), transform 0.2s var(--ease-quiet);
}

.chat-form button:hover {
  background: #fff9ed;
  transform: translateY(-1px);
}

.groups-toast {
  position: fixed;
  z-index: 110;
  left: 50%;
  bottom: 28px;
  padding: 10px 15px;
  border: 1px solid rgba(255, 246, 232, 0.28);
  border-radius: 8px;
  color: var(--warm-text);
  background: rgba(10, 31, 26, 0.94);
  box-shadow: 0 16px 34px rgba(2, 12, 8, 0.28);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s var(--ease-quiet), transform 0.25s var(--ease-quiet);
}

.groups-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .people-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px), (min-width: 761px) and (max-width: 1024px) and (orientation: portrait) {
  .groups-main { width: min(100% - 32px, 620px); padding-top: 112px; }
  .people-list { grid-template-columns: 1fr; }
  .messenger { grid-template-columns: 1fr; min-height: 650px; }
  .conversation-sidebar { max-height: 330px; }
  .conversation-section { margin-top: 15px; }
  .joined-room-section { padding-top: 14px; }
  .section-heading h1 { font-size: 26px; }
}
