/* Messenger dialogs, contact directory and conversation layout. */
html body .yprof.contact-profile {
  box-sizing: border-box;
  width: min(500px, calc(100vw - 16px)) !important;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}
html body .yprof.contact-profile.viewing-photo {
  width: min(500px, calc(100vw - 16px)) !important;
  height: min(480px, calc(100dvh - min(56px, 8vh) - 8px));
}
html.yd.ydpop body .yprof.contact-profile {
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  transform: none !important;
}
.contact-profile .tbar { flex: 0 0 auto; }
.contact-profile .pb { display: flex; flex-direction: column; min-height: 0; padding: 8px 12px 10px; }
.contact-profile .ph .pav { width: 42px; height: 42px; object-fit: cover; }
.contact-profile .profile-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: clamp(36px, 18dvh, 98px);
  gap: 5px;
  margin: 6px 0;
}
.contact-profile .profile-thumb { position: relative; padding: 2px !important; min-height: 0; }
.contact-profile .profile-thumb img, .contact-profile .profile-photo-large {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.contact-profile .profile-thumb span {
  position: absolute;
  bottom: 3px;
  right: 4px;
  padding: 0 4px;
  border-radius: 3px;
  background: #173b60;
  color: white;
  font-size: 11px;
}
.contact-profile .pbio, .contact-profile .pt td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-profile .pbio { margin: 4px 0; }
.contact-profile .pt { margin-top: 0; table-layout: fixed; }
.contact-profile .pt .profile-interests-value { white-space: normal; overflow-wrap: anywhere; }
.contact-profile .profile-interests-more { padding: 0 4px !important; font-size: inherit; }
.contact-profile .profile-interests-more.short-list { display:none; }
.contact-profile .profile-interests-viewer p { margin: 8px 0; line-height: 1.6; overflow-wrap: anywhere; }
.contact-profile .pt th, .contact-profile .pt td { padding-block: 1px; }
.contact-profile .pbtn { margin-top: 5px; }
.contact-profile.viewing-photo .pb { flex: 1; }
.contact-profile.viewing-photo .pb > :not(.profile-photo-viewer) { display: none !important; }
.contact-profile .profile-photo-viewer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  min-height: 0;
  flex: 1;
}
.contact-profile .profile-photo-back { justify-self: start; }
.contact-profile .profile-photo-large { min-height: 0; background: var(--card, #f1f5f8); }
.contact-profile .profile-photo-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.contact-profile .profile-photo-nav button { min-width: 32px; padding: 0 10px !important; }
@media (max-height: 400px) {
  .contact-profile .profile-photos { grid-auto-rows: 32px; }
  .contact-profile .profile-interests-preview { display:none; }
  .contact-profile .profile-interests-more.short-list { display:inline-block; }
  .contact-profile .pt th, .contact-profile .pt td { line-height:1.2; padding-block:0; }
  .contact-profile .pbio { margin:2px 0; }
}
.watch-shield { display: inline-flex; vertical-align: middle; color: #5587b8; }

html body .yprof.contact-directory {
  width: min(560px, calc(100vw - 16px)) !important;
  max-width: calc(100vw - 16px) !important;
  max-height: calc(100vh - 16px) !important;
  overflow-y: auto !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}
/* Add a contact: friendlier layout with live suggestions (Nov 13, 2026) */
.contact-directory .cd-intro { margin: 0 0 10px; color: var(--muted, #5b6f8c); line-height: 1.4; }
.contact-directory .cd-field { display: block; margin: 0 0 8px; font-weight: 600; }
.contact-directory .cd-field input { display: block; margin-top: 4px; padding: 8px 10px; border-radius: 6px; font-weight: 400; }
.contact-directory .cd-status { min-height: 1.2em; margin: 2px 0 6px; color: var(--muted, #5b6f8c); }
.contact-directory .directory-results { display: grid; gap: 4px; margin-bottom: 8px; }
.contact-directory .directory-person { gap: 10px; padding: 6px 8px; border: 1px solid var(--line, #dbe5ee); border-radius: 8px; background: var(--card, #fff); }
.contact-directory .cd-avw { flex: none; width: 32px; height: 32px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; }
.contact-directory .cd-avw :is(img, svg, .av) { width: 32px !important; height: 32px !important; border-radius: 7px; }
.contact-directory .cd-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.contact-directory .cd-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-directory .cd-who small { color: var(--muted, #5b6f8c); }
.contact-directory .cd-link { all: unset; cursor: pointer; color: var(--blue, #004990); text-decoration: underline; font-size: 12px; }
.contact-directory .cd-add { flex: none; min-width: 64px; }
.contact-directory .cd-add:disabled { opacity: .7; cursor: default; }
.contact-directory .pb { padding: 12px; }
.contact-directory input { width: 100%; box-sizing: border-box; }
.directory-person {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.directory-person strong { flex: 1 1 105px; overflow-wrap: anywhere; }
.directory-person button { padding: 4px 8px !important; }
.directory-pages { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.directory-pages[hidden] { display: none; }

html body .yprof.razzle-settings-dialog {
  max-height: none !important;
  overflow: visible !important;
}
html body .razzle-settings-dialog > .pb { overflow: visible !important; }
.razzle-settings-dialog section[hidden] { display: none !important; }
.razzle-settings-dialog section > label { display: block; margin: 6px 0; }
.settings-sections { display: flex; align-items: center; gap: 8px; }
.settings-sections select { flex: 1; min-width: 0; }
.archive-help { color: var(--muted); margin: 6px 0; }
#ysAq { min-width: 0; }
#ysAr { overflow-wrap: anywhere; }
html body .yprof.device-settings { width: min(560px, calc(100vw - 16px)) !important; }
.device-settings > .pb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .95fr);
  align-items: start;
  gap: 16px;
}
.device-options select { max-width: 100%; }
.device-settings .media-test-area { padding: 0; margin: 0; border: 0; }
.device-settings .media-test-area video {
  width: min(100%, 192px);
  height: auto;
  max-height: none;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
html.yd.ydpop body .yprof.razzle-settings-dialog,
html.yd.ydpop body .yprof.contact-directory {
  width: 100vw !important;
  max-width: none !important;
  min-height: 100vh !important;
  height: auto !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
}
@media (max-width: 465px) {
  .device-settings > .pb { grid-template-columns: 1fr; gap: 6px; }
  .device-settings .media-test-area video { width: 144px; }
}

html:has(#mwin) #brw .ft { padding: 8px 12px; }
html:not(.ydpop):not(.messenger-popout):has(#mwin) #brw {
  left: clamp(8px, calc(100vw - 736px), 380px);
}
html:has(#mwin) #brw .srch { margin: 8px 12px; }
html:has(#mwin) #brl { margin: 0 12px; }
html.yd.ydpop #brw.on #brl,
html.has-overlay #brw.on #brl {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

html:not(.ydpop):not(.messenger-popout) body .im {
  width: min(640px, calc(100vw - 16px)) !important;
}
html:not(.ydpop) body .im .log { height: clamp(100px, calc(100dvh - 275px), 225px); }
html.yd.ydpop body .im > .tbar { display: none !important; }
.im .fmt.open { flex-wrap: wrap; }
.im .ihead button[data-a="buzz"] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  padding: 4px 7px !important;
  white-space: nowrap;
}
.im .log .transcript-message {
  align-items: flex-start;
  max-width: 100% !important;
}
.im .log .transcript-message > .pm-sender-avatar {
  display: inline-flex !important;
  width: 30px !important;
  height: 30px !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
}
.im .log .transcript-message .bb { flex: 1 1 0; width: auto; min-width: 0; }
.im .log .pm-sender-avatar { align-self: flex-start; margin: 0 2px 0 0; }
.im .log .transcript-message [role="status"] { color: var(--muted); flex: 0 0 auto; }
.ygifpop { background: var(--card) !important; color: var(--ink) !important; }

html.dark:has(#mwin), html.dark.ydpop {
  --card: #2b3037;
  --surface: #242930;
  --soft: #353d48;
  --field: #20252c;
  --line: #48515e;
  --ink: #eef2f6;
  --muted: #b7c2cf;
  --blue: #91c8ff;
}
html.dark body #mwin :is(#main,#list,#tree,#tabs,#bottom,#me,#search,#foot),
html.dark.yd.yd-in body #mwin :is(#main,#list,#tree,#tabs,#bottom,#me,#search,#foot) {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html.dark.yd.yd-in #mwin #list :is(.grp,.ct .n),
html.dark body #mwin #list :is(.grp,.ct .n) { color: var(--ink) !important; }
html.dark.yd.yd-in #mwin #list .ct .sm,
html.dark body #mwin #list .ct .sm { color: var(--muted) !important; }
html.dark.yd.yd-in #mwin #list .ct:is(:hover,.sel),
html.dark body #mwin #list .ct:is(:hover,.sel) { background: var(--soft) !important; }
html.dark.yd.yd-in #mwin :is(#bAdd,#foot .brandname .a,#foot .brandname .b) {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html.dark body #mwin #tabs > div {
  background: var(--card) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html.dark .im :is(.ihead,.inbox,.fmt,.mbar) { background: var(--card) !important; color: var(--ink) !important; }

html.yd.ydpop .contact-profile .profile-photos { grid-auto-rows: clamp(32px, calc((100dvh - 260px) / 2), 98px); }
#me .stw #stdot { position: static !important; inset: auto !important; margin: 0; flex: none; align-self: center; }
#rhead #thm { position: static !important; flex: none; margin-left: 6px; }
.room-owner-line { color: var(--muted); font-size: 11px; margin-top: 3px; }
.room-peek-button { flex: none; padding: 3px 5px !important; }
.chat-text-size-label { color:var(--muted); font-size:12px; font-weight:600; }
@media(max-width:850px) { .chat-text-size-label span { display:none; } }

.room-alert-stack { position:fixed; inset:auto max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) auto; width:min(320px, calc(100vw - 24px)); display:grid; gap:6px; z-index:6000; }
.room-activity-toast { display:flex; align-items:center; gap:7px; padding:8px 9px; border:1px solid var(--line,#cbd8ea); border-radius:7px; background:var(--card,#fff); color:var(--ink,#12213f); box-shadow:0 3px 14px #13284922; font:13px/1.35 system-ui,sans-serif; }
.room-activity-toast span { flex:1; min-width:0; overflow-wrap:anywhere; }
.room-activity-toast button { padding:4px 7px !important; white-space:nowrap; }
