.ph-social {
  --social-surface:var(--surface-2,#202020);
  --social-deep:var(--surface,#171717);
  --social-raised:var(--surface-3,#303030);
  --social-accent:var(--text,#fff);
  --social-accent-text:var(--bg,#111);
  color:var(--text,#fff);
}
html[data-appearance="seasonal"] .ph-social {
  --social-accent:#a6ddea;
  --social-accent-text:#102832;
}
html[data-appearance="seasonal"][data-theme="dark"] .ph-social {
  --social-surface:#112735;
  --social-deep:#0e202d;
  --social-raised:#193747;
}
.ph-social [hidden], .ph-social[hidden] { display:none !important; }
.topbar-actions .ph-social-trigger { position:relative; }
.topbar-actions .ph-social-trigger[aria-expanded="true"] { background:var(--surface-3); color:var(--text); }
.topbar-actions #ph-social-friends .notification-badge { background:#e5c48b; color:#172631; }
.ph-social-button,.ph-social-icon {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:7px 11px;
  min-height:36px; border:1px solid var(--line); border-radius:9px; background:var(--social-deep);
  color:inherit; font:inherit; font-size:12px; font-weight:700; text-align:center; cursor:pointer;
}
.ph-social-button.primary { background:var(--social-accent); color:var(--social-accent-text); border-color:transparent; }
.ph-social-button.danger { background:#8f354b; color:#fff; border-color:#a34f65; }
.ph-social-icon { width:36px; flex:none; padding:0; }
.ph-social :is(button,input,a):focus-visible { outline:2px solid var(--social-accent); outline-offset:2px; }
.ph-social button:disabled { opacity:.6; cursor:default; }
.ph-social :is(.ph-social-button,.ph-social-icon) svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.ph-social-pop,.ph-social-dock { position:fixed; right:max(14px,env(safe-area-inset-right)); width:min(364px,calc(100% - 24px)); background:var(--social-surface); border:1px solid var(--line); overflow:hidden; box-shadow:0 16px 46px #0007; }
.ph-social-pop { z-index:124; top:var(--social-top,64px); display:flex; flex-direction:column; max-height:calc(100dvh - var(--social-top,64px) - 10px); border-radius:15px; }
.ph-social-dock { z-index:117; bottom:0; max-height:calc(100dvh - 82px); display:flex; flex-direction:column; border-radius:14px 14px 0 0; border-bottom:0; }
.ph-social-pop-head,.ph-social-pop-foot,.ph-social-chat-head { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:10px 12px; }
.ph-social-pop-head,.ph-social-chat-head { border-bottom:1px solid var(--line); }
.ph-social-pop-head h2,.ph-social-card h2 { font-size:17px; line-height:1.25; margin:0; }
.ph-social-pop-head small,.ph-social-person small,.ph-social-row-time small,.ph-social-settings small { display:block; margin-top:2px; color:var(--muted); font-size:12px; }
.ph-social-pop-foot { flex-direction:column; border-top:1px solid var(--line); }
.ph-social-pop-foot button { width:100%; }
.ph-social-pop-list { overflow:auto; padding:5px; }
.ph-social-row,.ph-social-invite { width:100%; align-items:center; gap:8px; padding:7px; text-align:left; min-width:0; }
.ph-social-row { display:grid; grid-template-columns:auto minmax(0,1fr) auto; min-height:58px; border:1px solid transparent; border-radius:9px; background:transparent; color:inherit; font:inherit; cursor:pointer; }
.ph-social-row:is(.is-unread,[aria-current="true"]) { background:var(--social-raised); }
.ph-social-row[aria-current="true"] { border-color:var(--line); }
.ph-social-invite { display:flex; flex-wrap:wrap; }
.ph-social-invite+.ph-social-invite { border-top:1px solid var(--line); }
.ph-social-invite .ph-social-person { flex:1 1 100px; }
.ph-social-invite .ph-social-person small { overflow-wrap:anywhere; }
.ph-social-avatar { position:relative; display:grid; place-items:center; width:37px; height:37px; flex:none; border-radius:50%; overflow:hidden; background:var(--social-raised); color:inherit; font-weight:850; box-shadow:inset 0 0 0 1px var(--line); }
.ph-social-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.ph-social-avatar.ultra-frame { overflow:visible; isolation:isolate; }
.ph-social-avatar.ultra-frame::before { inset:-3px; padding:2px; }
.ph-social-avatar img[hidden] { display:none; }
.ph-social-person { flex:1; min-width:0; }
.ph-social-person strong,.ph-social-row .ph-social-person small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ph-social-person a { color:inherit; font-weight:750; }
.ph-social-row-time { align-self:start; text-align:right; }
.ph-social-row-time i { display:block; width:7px; height:7px; margin:5px 0 0 auto; border-radius:50%; background:var(--social-accent); }
.ph-social-empty { margin:0; padding:13px 10px; color:var(--muted); }
.ph-social-chat-head { justify-content:flex-start; background:var(--social-raised); }
.ph-social-chat-head .ph-social-avatar { width:32px; height:32px; }
.ph-social-chat-head .ph-social-icon { width:32px; min-height:33px; }
.ph-social-log { display:flex; flex-direction:column; gap:8px; align-items:stretch; overflow:auto; min-height:120px; padding:10px; overscroll-behavior:contain; }
.ph-social-dock .ph-social-log { height:min(250px,42dvh); }
.ph-social-log > button { align-self:center; }
.ph-social-bubble { display:grid; justify-items:start; gap:2px; }
.ph-social-bubble.mine { justify-items:end; }
.ph-social-bubble p { margin:0; max-width:88%; border-radius:12px 12px 12px 4px; padding:7px 9px; white-space:pre-wrap; overflow-wrap:anywhere; background:var(--social-raised); font-size:13px; }
.ph-social-bubble.mine p { background:var(--social-accent); color:var(--social-accent-text); border-radius:12px 12px 4px 12px; }
.ph-social-bubble time { color:var(--muted); font-size:11px; }
.ph-social-compose { display:flex; align-items:center; gap:7px; border-top:1px solid var(--line); padding:8px; }
.ph-social-compose input { width:100%; min-width:0; min-height:37px; border:1px solid var(--line); border-radius:9px; background:var(--social-deep); color:inherit; padding:8px 10px; font:inherit; }
.ph-social-compose input::placeholder { color:var(--muted); }
.ph-social-profile-actions,.ph-social-tabs,.ph-social-actions { display:flex; flex-wrap:wrap; gap:6px; }
.ph-social-profile-actions { justify-content:flex-end; }
.ph-social-page { display:grid; gap:12px; }
.ph-social-hero { margin:0; }
.ph-social-tabs .active { background:var(--social-raised); border-color:var(--social-accent); }
.ph-social-layout { display:grid; grid-template-columns:minmax(185px,1fr) minmax(0,2.3fr); min-height:380px; border:1px solid var(--line); border-radius:13px; overflow:hidden; background:var(--social-surface); }
.ph-social-list { padding:8px; border-right:1px solid var(--line); background:var(--social-deep); max-height:min(650px,68dvh); overflow:auto; }
.ph-social-list h2 { margin:3px 5px 7px; font-size:14px; }
.ph-social-full-chat { display:flex; flex-direction:column; min-width:0; }
.ph-social-full-chat .ph-social-log { flex:1; max-height:min(530px,57dvh); }
.ph-social-full-chat .mobile-only { display:none; }
.ph-social-card,.ph-social-modal { background:var(--social-surface); border:1px solid var(--line); border-radius:13px; padding:14px; }
.ph-social-card h2:not(:first-child) { margin-top:13px; }
.ph-social-settings { display:grid; gap:9px; padding:8px 0; }
.ph-social-settings label { display:flex; gap:8px; align-items:start; }
.ph-social-settings input { margin-top:4px; accent-color:var(--social-accent); }
.ph-social-settings button { justify-self:start; }
.ph-social-modal { color:var(--text); width:min(400px,calc(100% - 22px)); }
.ph-social-modal::backdrop { background:#0009; }
.ph-social-modal h2 { margin:0; font-size:17px; }
.ph-social-modal .ph-social-actions { justify-content:end; }
@media (hover:hover) {
  .ph-social-row:hover { background:var(--social-raised); }
  .ph-social :is(.ph-social-button,.ph-social-icon):hover:not(:disabled) { border-color:var(--social-accent); }
}
@media (max-width:650px) {
  .topbar-actions .ph-social-trigger { width:36px; height:36px; }
  .ph-social-pop,.ph-social-dock { right:8px; width:min(390px,calc(100% - 16px)); }
  .ph-social-dock { bottom:calc(58px + env(safe-area-inset-bottom)); border-bottom:1px solid var(--line); border-radius:13px; }
  .ph-social-compose input { font-size:16px; }
  .ph-social-layout { display:block; min-height:0; }
  .ph-social-list { border:0; }
  .ph-social-layout:not(.has-thread) .ph-social-full-chat,.ph-social-layout.has-thread .ph-social-list { display:none; }
  .ph-social-full-chat .mobile-only { display:inline-flex; }
  .ph-social-profile-actions { justify-content:flex-start; }
}
@media (max-width:375px) {
  .topbar .topbar-actions { gap:2px; }
  .topbar .topbar-actions .ph-social-trigger { width:33px; }
}
