/* MacroQuest Friends / Party UI v1 */

.friends-panel{
  margin-top:16px;
}
.friends-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:16px;
}
.friends-head h3{
  margin:5px 0 5px;
}
.friends-head p{
  margin:0;
  max-width:720px;
}
.friend-handle-card{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:14px;
  align-items:end;
  padding:14px;
  margin-bottom:14px;
  border:1px solid var(--line);
  border-radius:9px;
  background:rgba(5,16,29,.27);
}
.friend-handle-card label{
  display:grid;
  gap:6px;
  color:#b8c5d7;
  font-size:11px;
}
.friend-handle-input-wrap{
  display:flex;
  align-items:center;
  min-width:0;
  border:1px solid #31435d;
  border-radius:6px;
  background:#0c1625;
  overflow:hidden;
}
.friend-handle-at{
  padding:0 0 0 11px;
  color:var(--mint);
  font-weight:800;
}
.friend-handle-input-wrap input{
  width:100%;
  min-width:0;
  border:0;
  outline:0;
  background:transparent;
  color:#fff;
  padding:10px 11px 10px 4px;
}
.friend-handle-help{
  grid-column:1/-1;
  color:var(--muted);
  font-size:10px;
  line-height:1.45;
}
.add-friend-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:9px;
  margin-bottom:18px;
}
.add-friend-form input{
  min-width:0;
  background:#0c1625;
  border:1px solid #31435d;
  color:#fff;
  border-radius:6px;
  padding:11px;
}
.friend-sections{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(250px,.8fr);
  gap:14px;
}
.friend-section{
  min-width:0;
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
  background:rgba(5,16,29,.22);
}
.friend-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:13px 14px;
  border-bottom:1px solid var(--line);
}
.friend-section-head h4{
  margin:0;
  font-size:13px;
}
.friend-count{
  min-width:24px;
  padding:3px 7px;
  border-radius:999px;
  background:rgba(105,218,165,.10);
  color:var(--mint);
  text-align:center;
  font-size:10px;
  font-weight:800;
}
.friend-list{
  display:grid;
}
.friend-row{
  display:grid;
  grid-template-columns:44px minmax(0,1fr) auto;
  gap:11px;
  align-items:center;
  padding:12px 14px;
  border-bottom:1px solid rgba(42,59,82,.72);
}
.friend-row:last-child{
  border-bottom:0;
}
.friend-row-main{
  min-width:0;
}
.friend-row-name{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  text-align:left;
}
.friend-row-name:hover,
.friend-row-name:focus-visible{
  color:var(--mint);
  outline:none;
}
.friend-row-meta{
  margin-top:3px;
  color:var(--muted);
  font-size:10px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.friend-row-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
  flex-wrap:wrap;
}
.friend-mini-avatar{
  position:relative;
  width:40px;
  height:48px;
  overflow:hidden;
  border:1px solid #31435d;
  border-radius:7px;
  background:#15243a;
}
.friend-mini-avatar .avatar-sprite{
  position:absolute !important;
  top:50% !important;
  left:50% !important;
  margin:0 !important;
  transform:translate(-50%,-50%) scale(.48) !important;
  transform-origin:center center !important;
}
.friend-empty{
  padding:18px 14px;
  color:var(--muted);
  font-size:11px;
  line-height:1.5;
}
.friend-subsection + .friend-subsection{
  border-top:1px solid var(--line);
}
.friend-subsection-title{
  display:flex;
  justify-content:space-between;
  gap:8px;
  padding:11px 14px 7px;
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.friend-request-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  padding:10px 14px;
  border-top:1px solid rgba(42,59,82,.55);
}
.friend-request-row strong{
  display:block;
  font-size:12px;
}
.friend-request-row small{
  display:block;
  margin-top:2px;
  color:var(--muted);
}
.friend-character-dialog{
  width:min(92vw,720px);
  max-width:720px;
}
.friend-character-card{
  display:grid;
  gap:16px;
}
.friend-character-hero{
  display:grid;
  grid-template-columns:120px minmax(0,1fr);
  gap:18px;
  align-items:center;
  padding:16px;
  border:1px solid var(--line);
  border-radius:10px;
  background:linear-gradient(145deg,#17263d,#101b2d);
}
.friend-profile-avatar{
  position:relative;
  display:grid;
  place-items:center;
  height:132px;
  overflow:hidden;
  border:1px solid #31445f;
  border-radius:9px;
  background:#182943;
}
.friend-profile-avatar .pixel-grid{
  position:absolute;
  inset:0;
}
.friend-profile-avatar .avatar-sprite{
  transform:scale(1.05);
}
.friend-character-name{
  margin:4px 0 3px;
  font:800 27px/1 Georgia,serif;
}
.friend-character-handle{
  color:var(--muted);
  font-size:11px;
}
.friend-character-level{
  margin-top:13px;
}
.friend-character-level-line{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:7px;
  font-size:10px;
}
.friend-character-stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:9px;
}
.friend-character-stat{
  padding:12px;
  border:1px solid var(--line);
  border-radius:7px;
  background:#0f1a2b;
  text-align:center;
}
.friend-character-stat small{
  display:block;
  color:var(--muted);
  font:700 9px Georgia,serif;
}
.friend-character-stat b{
  display:block;
  margin-top:4px;
  font:700 16px Georgia,serif;
}
.friend-character-cosmetics{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}
.friend-character-chip{
  padding:6px 8px;
  border:1px solid #31517b;
  border-radius:999px;
  background:#122440;
  color:#dce8f6;
  font-size:10px;
}

body[data-mq-theme="parchment"] .friend-handle-card,
body[data-mq-theme="parchment"] .friend-section{
  border-color:#b58d60;
  background:rgba(255,248,233,.58);
}
body[data-mq-theme="parchment"] .friend-handle-input-wrap,
body[data-mq-theme="parchment"] .add-friend-form input{
  border-color:#b58d60;
  background:rgba(255,250,240,.86);
  color:#3f2a1a;
}
body[data-mq-theme="parchment"] .friend-character-hero{
  border-color:#b58d60;
  background:linear-gradient(145deg,rgba(255,249,235,.96),rgba(240,220,184,.93));
}
body[data-mq-theme="parchment"] .friend-character-stat{
  border-color:#b58d60;
  background:rgba(255,248,233,.75);
}
body[data-mq-theme="parchment"] .friend-character-chip{
  border-color:#a47b4d;
  background:rgba(151,105,53,.08);
  color:#53391f;
}

@media(max-width:850px){
  .friend-sections{
    grid-template-columns:1fr;
  }
}
@media(max-width:680px){
  .friends-head{
    flex-direction:column;
  }
  .friend-handle-card,
  .add-friend-form{
    grid-template-columns:1fr;
  }
  .friend-row{
    grid-template-columns:40px minmax(0,1fr);
  }
  .friend-row-actions{
    grid-column:1/-1;
    justify-content:flex-start;
    padding-left:51px;
  }
  .friend-character-hero{
    grid-template-columns:94px minmax(0,1fr);
    gap:12px;
    padding:12px;
  }
  .friend-profile-avatar{
    height:108px;
  }
  .friend-character-name{
    font-size:22px;
  }
  .friend-character-stats{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
