/* The chat hub: an inbox and a thread, after Instagram's direct messages. Shared by the Community screen and the map dock. */
.ig { --bub: var(--surface-2); --ig-line: var(--line-soft); position: relative; display: flex; height: 100%; min-height: 0; }
:root[data-theme="dark"] .ig { --bub: var(--surface-3); }
.ig__inbox, .ig__thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ig__inbox { flex: none; width: 350px; }
.ig__thread { position: relative; flex: 1; }

/* Community screen frame */
.comm.comm--chat { max-width: 1120px; }
.comm__hub { flex: 1; min-height: 0; }
.comm__top .comm__tabs { max-width: 350px; }
@media (min-width: 768px) {
  .comm--chat .ig { border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
  .comm--chat .ig__inbox { border-right: 1px solid var(--ig-line); padding-top: 16px; }
  :root[data-theme="dark"] .comm--chat .ig { background: rgba(255,255,255,.05); }
}
@media (max-width: 1000px) and (min-width: 768px) { .comm--chat .ig__inbox { width: 290px; } }
@media (max-width: 767px) {
  .ig:not(.ig--compact)[data-view="inbox"] .ig__thread, .ig:not(.ig--compact)[data-view="thread"] .ig__inbox { display: none; }
  .ig:not(.ig--compact) .ig__inbox { width: 100%; }
  .comm:has(.ig[data-view="thread"]) { padding: 0; }
  .comm:has(.ig[data-view="thread"]) .comm__top { display: none; }
  .app:has(.comm .ig[data-view="thread"]) .nav--foot { display: none; }
  .comm:has(.ig[data-view="inbox"]) { padding: 18px 0 0; }
  .comm__top { padding: 0 16px; }
  .ig:not(.ig--compact) .ighead { min-height: 80px; padding-right: 78px; } /* clear of the hide switch */
  .ig[data-view="inbox"] .igrows { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}
.ig--compact { flex-direction: column; }
.ig--compact .ig__inbox, .ig--compact .ig__thread { width: 100%; flex: 1; }
.ig--compact[data-view="inbox"] .ig__thread, .ig--compact[data-view="thread"] .ig__inbox { display: none; }
.ig--compact .ig__inbox { padding-top: 10px; }

/* Avatars: initials on a plain circle, code names have no faces */
.igav { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.igav--big { width: 84px; height: 84px; font-size: 26px; }
.igavwrap { position: relative; flex: none; display: block; }
.igavwrap i, .igperson__av i { position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%; background: #2fd158; box-shadow: 0 0 0 3px var(--surface); }
.igav2 { position: relative; flex: none; display: block; width: 52px; height: 52px; }
.igav2 .igav { position: absolute; width: 36px; height: 36px; font-size: 11.5px; }
.igav2 .igav:first-child { top: 0; right: 0; color: transparent; }
.igav2 .igav:last-child { left: 0; bottom: 0; box-shadow: 0 0 0 2.5px var(--surface); }

/* Inbox */
.igsearch { flex: none; display: flex; align-items: center; gap: 10px; height: 42px; margin: 0 16px 12px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.igsearch svg { flex: none; width: 17px; height: 17px; }
.igsearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.igsearch input::placeholder { color: var(--muted); }
.igactive { flex: none; display: flex; gap: 14px; padding: 2px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.igactive::-webkit-scrollbar { display: none; }
.igperson { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 66px; }
.igperson small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-2); }
.igperson__av { position: relative; display: block; padding: 3px; border-radius: 50%; }
.igperson__av .igav { width: 60px; height: 60px; font-size: 17px; }
.igperson__av.has-ring { background: conic-gradient(from 210deg, var(--accent-hi), var(--accent), var(--accent-lo), var(--accent-hi)); }
.igperson__av.has-ring .igav { box-shadow: 0 0 0 3px var(--surface); }
.igperson__av i { right: 4px; bottom: 4px; }
.iglabel { flex: none; padding: 2px 16px 8px; font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; }
.igrows { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.igrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; text-align: left; transition: background .15s; }
.igrow:hover, .igrow.is-on { background: var(--surface-2); }
.igrow__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.igrow__t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 500; letter-spacing: -.01em; }
.igrow__t > span { display: flex; gap: 6px; font-size: 13.5px; color: var(--muted); }
.igrow__p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.igrow__p em { font-style: normal; color: var(--accent); }
.igrow__p .fbadge { vertical-align: -3px; }
.igrow time { flex: none; }
.igrow time::before { content: "· "; }
.igrow.is-new .igrow__t b { font-weight: 700; }
.igrow.is-new .igrow__t > span { color: var(--text); font-weight: 600; }
.igrow__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.ignone { padding: 16px; font-size: 14px; color: var(--muted); }

/* Thread */
.ighead { flex: none; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--ig-line); }
.ighead__back { display: none; place-items: center; flex: none; width: 36px; height: 36px; margin-left: -8px; border-radius: 50%; }
.ighead__back svg { width: 22px; height: 22px; }
.ighead .igav, .ighead .igavwrap, .ighead .igav2 { width: 42px; height: 42px; }
.ighead .igavwrap i { width: 12px; height: 12px; }
.ighead .igav { font-size: 13px; }
.ighead .igav2 .igav { width: 29px; height: 29px; font-size: 10px; }
.ighead__t { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ighead__t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; }
.ighead__t span { font-size: 12.5px; color: var(--muted); }
.ig--compact .ighead__back { display: grid; }
@media (max-width: 767px) { .ighead__back { display: grid; } }

.igbody { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; overscroll-behavior: contain; scrollbar-width: thin; touch-action: manipulation; }
.igtime { margin: 16px 0 12px; text-align: center; font-size: 12px; color: var(--muted); }
.igmsg { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.igmsg.is-first { margin-top: 10px; }
.igmsg.has-react { margin-bottom: 18px; }
.igmsg.is-in { animation: igIn .28s var(--ease); }
@keyframes igIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.igmsg.is-me { justify-content: flex-end; }
.igmsg .igav { width: 28px; height: 28px; font-size: 9.5px; }
.igmsg__av { flex: none; display: block; }
.igmsg__gap { flex: none; width: 28px; }
.igmsg__col { min-width: 0; max-width: min(74%, 440px); display: flex; flex-direction: column; align-items: flex-start; }
.is-me .igmsg__col { align-items: flex-end; }
.igname { margin: 0 0 3px 12px; font-size: 12px; color: var(--muted); }
.igmsg__wrap { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.is-me .igmsg__wrap { flex-direction: row-reverse; }
.igmsg__box { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; cursor: default; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.is-me .igmsg__box { align-items: flex-end; }
.igmsg__more { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--muted); opacity: 0; transition: opacity .15s; }
.igmsg__more svg { width: 17px; height: 17px; }
@media (hover: hover) { .igmsg:hover .igmsg__more { opacity: 1; } }
@media (hover: none) { .igmsg__more { display: none; } }

.igbub { padding: 9px 14px; border-radius: 22px; background: var(--bub); color: var(--text); font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.igbub .fbadge { vertical-align: -4px; }
.is-me .igbub { background: linear-gradient(180deg, var(--accent-hi) -40%, var(--accent) 45%, var(--accent-lo) 140%); color: var(--on-accent); }
/* Bubbles in a run sit tight, with the corners on the sender's side pulled in */
.igmsg:not(.is-me):not(.is-first) .igbub { border-top-left-radius: 6px; }
.igmsg:not(.is-me):not(.is-last) .igbub { border-bottom-left-radius: 6px; }
.igmsg.is-me:not(.is-first) .igbub { border-top-right-radius: 6px; }
.igmsg.is-me:not(.is-last) .igbub { border-bottom-right-radius: 6px; }
.igpic { display: block; width: 240px; max-width: 100%; max-height: 300px; object-fit: cover; border-radius: 20px; }
.igpic + .igbub { margin-top: 3px; }
.igquote { max-width: 100%; margin-bottom: -10px; padding: 8px 14px 15px; border-radius: 18px 18px 6px 6px; background: var(--bub); opacity: .62; font-size: 12.5px; line-height: 1.3; color: var(--text-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.igquote b { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.igreact { position: absolute; left: 10px; bottom: -16px; display: flex; gap: 3px; padding: 2px 7px; height: 22px; align-items: center; border-radius: 999px; background: var(--bub); box-shadow: 0 0 0 2px var(--surface); font-size: 12px; animation: igPop .3s var(--spring); }
.is-me .igreact { left: auto; right: 10px; }
.igreact small { margin-left: 2px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.igreact .is-mine small { color: var(--accent); }
@keyframes igPop { from { transform: scale(.4); opacity: 0; } }
.igseen { margin: 4px 4px 0 0; text-align: right; font-size: 12px; color: var(--muted); }
.igdots { display: flex; gap: 4px; padding: 13px 15px; border-radius: 22px; background: var(--bub); }
.igdots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: igDot 1.1s infinite; }
.igdots i:nth-child(2) { animation-delay: .15s; }
.igdots i:nth-child(3) { animation-delay: .3s; }
@keyframes igDot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.igstart, .igempty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--muted); font-size: 13.5px; }
.igstart { padding: 40px 0; }
.igstart b, .igempty b { margin-top: 6px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.igempty { flex: 1; }
.igempty svg { width: 54px; height: 54px; color: var(--text); }

/* The press-and-hold reaction bar */
.igbar { position: absolute; z-index: 5; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-nav); animation: igPop .22s var(--spring); }
:root[data-theme="dark"] .igbar { background: var(--surface-3); }
.igbar button { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 21px; transition: transform .2s var(--spring); }
.igbar button:hover { transform: scale(1.2); }
.igbar__reply svg { width: 19px; height: 19px; }

/* Composer */
.igfoot { flex: none; padding: 6px 12px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
.igreply { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px 14px; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.igreply span { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.igreply b { color: var(--text); font-weight: 600; }
.igreply button { flex: none; display: grid; place-items: center; width: 28px; height: 28px; }
.igreply svg { width: 16px; height: 16px; }
.igcompose { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 5px 14px 5px 5px; border-radius: 999px; background: var(--surface-2); }
.igcompose__cam { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--on-accent); cursor: pointer; transition: transform .2s var(--spring); }
.igcompose__cam:active { transform: scale(.9); }
.igcompose__cam svg { width: 19px; height: 19px; }
.igcompose input:not([type=file]) { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.igcompose input::placeholder { color: var(--muted); }
.igcompose__send { flex: none; font-size: 15px; font-weight: 700; color: var(--accent); animation: fade .15s; }
:root[data-accent="green"][data-theme="light"] .igcompose__send, :root[data-accent="green"][data-theme="light"] .igrow__p em { color: var(--text); }
:root[data-accent="green"][data-theme="light"] .igrow__dot { background: var(--text); }
@media (max-width: 767px) { .igsearch input, .igcompose input:not([type=file]) { font-size: 16px; } }

/* The map dock */
.dock__hub { flex: 1; min-height: 0; }
.dock .igactive { gap: 8px; padding: 0 12px 8px; }
.dock .igperson { width: 54px; }
.dock .igperson__av .igav { width: 46px; height: 46px; font-size: 13px; }
.dock .igsearch { display: none; }
.dock .iglabel { padding: 2px 14px 6px; font-size: 14px; }
.dock .igrow { padding: 7px 14px; gap: 10px; }
.dock .igrow .igav, .dock .igrow .igavwrap, .dock .igrow .igav2 { width: 46px; height: 46px; }
.dock .igrow .igav2 .igav { width: 32px; height: 32px; }
.dock .ighead { min-height: 52px; padding: 6px 12px; }
.dock .ighead__t b { font-size: 14px; }
.dock .igbody { padding: 10px 10px 6px; }
.dock .igfoot { padding: 4px 8px 8px; }
.dock .igcompose { min-height: 42px; }
.dock .igcompose__cam { width: 32px; height: 32px; }
.dock .igpic { width: 180px; }
:root[data-theme="dark"] .dock .ig { --bub: rgba(255,255,255,.14); }
:root[data-theme="dark"] .dock .igcompose, :root[data-theme="dark"] .dock .igrow:hover { background: rgba(255,255,255,.1); }
:root[data-theme="dark"] .dock .igav { background: rgba(255,255,255,.16); }
:root[data-theme="dark"] .dock .igbar { background: #2c2c30; }
@media (min-width: 768px) { .dock { width: 360px; height: 520px; } }
