#ctv-friends {
  width: min(440px, calc(100% - 20px));
}
#ctv-friends [hidden] { display: none; }

#ctv-friends-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 13px; scrollbar-gutter: stable; }
#ctv-friends-status { margin: 0; padding: 8px 13px; background: #feeabd; color: #5e3b18; }
#ctv-friends-tabs {
  display: grid;
  flex-shrink: 0;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: stretch;
  gap: 7px;
  border-bottom: 1px solid #94b9ce;
  background: #b8d6e888;
  padding: 9px 12px;
}

#ctv-friends button:not(.ctv-game-panel-close) {
  min-height: 36px;
  border: 1px solid #82aac1;
  border-radius: 7px;
  background: linear-gradient(#f3fbff, #ddecf6);
  color: #163e57;
  padding: 7px 10px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  overflow-wrap: anywhere;
}

#ctv-friends button[aria-pressed="true"],
#ctv-friends button.ctv-friend-primary {
  border-color: #bf9346;
  box-shadow: inset 0 1px #fff4c4;
  background: linear-gradient(#fff1bb, #e7b859);
  color: #3f2b13;
}

#ctv-friends button:disabled { opacity: .56; cursor: default; }
#ctv-friends :is(h3, p) { margin-block: 0; }
#ctv-friends h3 { font-size: 15px; }
.ctv-friend-muted { color: #3b596d; }
.ctv-friend-rows { display: grid; gap: 8px; margin-top: 10px; }
.ctv-friend-row {
  display: flex;
  flex-wrap: wrap;
  place-items: center start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #aac9db;
  border-radius: 8px;
  background: #edf8fe;
}
.ctv-friend-row > :is(div:first-child, .ctv-friend-reward-text) { min-width: min(100%, 100px); flex: 1; overflow-wrap: anywhere; }
.ctv-friend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctv-friend-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: stretch; }
#ctv-friends .ctv-friend-form button { min-inline-size: 56px; white-space: nowrap; }

#ctv-friends input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  border: 1px solid #86aebf;
  border-radius: 7px;
  padding: 6px 8px;
  color: #173955;
  background: #f7fcff;
  font: 16px/1.3 system-ui, sans-serif;
}
.ctv-friend-summary { display: flex; align-items: center; gap: 12px; margin-block: 12px; overflow-wrap: anywhere; }
.ctv-friend-summary img, .ctv-friend-placeholder {
  box-sizing: border-box;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid #9dc4da;
  border-radius: 9px;
  object-fit: cover;
}
.ctv-friend-placeholder { display: grid; place-items: center; background: #dceef9; font-size: 22px; font-weight: 700; }
.ctv-friend-stats { display: grid; gap: 7px; margin-block: 12px; }
.ctv-friend-stats div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.ctv-friend-stats dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.ctv-friend-chat { display: grid; gap: 6px; align-content: start; height: min(310px, 41dvh); overflow: auto; padding: 7px; }
.ctv-friend-chat p { justify-self: start; max-width: 85%; padding: 7px 9px; border-radius: 8px; background: #d8eaf7; overflow-wrap: anywhere; }
.ctv-friend-chat p.mine { justify-self: end; background: #27698b; color: white; }
.ctv-friend-chat time { display: block; margin-top: 3px; font-size: 10px; opacity: .82; }
.ctv-friend-chat button { justify-self: center; }
.ctv-friend-section { margin-block: 12px; }
.ctv-friend-link { margin-block: 6px; }
.ctv-friend-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 100px;
  align-content: center;
  border: 1px solid #abc8d9;
  border-radius: 10px;
  background: #f0f8fc99;
  color: #3b596d;
}
.ctv-friend-empty .ctv-game-panel-mark { filter: brightness(.65) saturate(1.4); }
.ctv-friend-invite {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #a7c6da;
  border-radius: 10px;
  background: #edf7fd;
}
.ctv-friend-invite dl {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.ctv-friend-invite dl div {
  min-width: 0;
  display: flex;
  flex-direction: column-reverse;
  padding: 6px 3px;
  text-align: center;
  border-radius: 6px;
  background: #d9edf7;
  color: #285268;
  font-size: 11px;
}
.ctv-friend-invite dd { margin: 0; font-size: 18px; font-weight: 750; overflow-wrap: anywhere; }
.ctv-friend-invite dl div:last-child { background: #f9edc8; color: #61491a; }
.ctv-friend-invite .ctv-friend-link { margin: 0; }
