/* Friends → Chats: the title with its icons, thoughts and modes on rows, their cards, Contacts,
   and a mode in a chat (tag under the name, notice above the message box). */

/* ---------- Title + icons ---------- */
.friends-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 2px 12px; }
.friends-title { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; color: #171717; font: inherit; font-size: 29px; font-weight: 800; letter-spacing: -.6px; white-space: nowrap; cursor: pointer; }
@media (max-width: 380px) { .friends-title { font-size: 25px; } .friends-tool { width: 35px; } }
.friends-title [data-friends-title-text] { display: inline-block; }
.friends-title-caret { flex: none; margin-top: 4px; color: #6c6d67; }
.friends-title.is-popping [data-friends-title-text] { animation: friendsTitlePop .34s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes friendsTitlePop { 0% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
.friends-tools { flex: none; height: 46px; padding: 0 4px; border-radius: 23px; display: flex; align-items: center; gap: 2px; background: #fff; box-shadow: 0 0 0 1px #ecebe6, 0 2px 8px rgb(0 0 0 / .04); }
.friends-tool { position: relative; width: 38px; height: 40px; padding: 0; border: 0; border-radius: 20px; display: grid; place-items: center; background: none; color: #222; cursor: pointer; }
.friends-tool:active { background: #f2f2f0; }
.friends-tool svg { display: block; }
.friends-tool-dot { position: absolute; top: 7px; right: 5px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: conic-gradient(from 200deg, #f7a593, #f7c74b, #61c8e6, #468093, #f7a593); }
.friends-tool-dot[hidden] { display: none; }

/* Your mode: the moon becomes a chip in the mode's color, a ring that empties, the time left. */
.friends-mode-chip { display: none; }
.friends-mode.is-on { width: auto; height: 34px; margin: 0 3px; padding: 0 11px 0 4px; border-radius: 17px; background: var(--m-bg); color: var(--m-ink); font-size: 13px; font-weight: 750; white-space: nowrap; animation: presenceBreathe 3.2s ease-in-out infinite; }
.friends-mode.is-on > svg { display: none; }
.friends-mode.is-on .friends-mode-chip { display: inline-flex; align-items: center; gap: 6px; }
.friends-mode.is-on.is-popping { animation: presenceChipIn .42s cubic-bezier(.3, 1.5, .5, 1), presenceBreathe 3.2s ease-in-out .42s infinite; }
@keyframes presenceBreathe { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--m-glow); } }
@keyframes presenceChipIn { 0% { opacity: 0; transform: scale(.5); } 100% { opacity: 1; transform: scale(1); } }
.presence-ring { position: relative; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--m-ring) calc(var(--p, 1) * 360deg), rgb(0 0 0 / .08) 0); }
.presence-ring::before { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: #fff; }
.presence-ring i { position: relative; font-size: 12.5px; font-style: normal; line-height: 1; }

/* ---------- Rows: a thought or mode covers the name and last message until seen ---------- */
.link-contact > .presence-cover { grid-column: 2 / -1; min-width: 0; margin: -3px -6px; padding: 5px 10px; border-radius: 12px; background: linear-gradient(90deg, #fff4ea, #eef8fc); text-align: left; cursor: pointer; }
.link-contact > .presence-cover[hidden] { display: none; }
.presence-cover > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: #3f3428; font-size: 14.5px; font-weight: 500; line-height: 1.32; white-space: normal; }
.presence-cover b { color: #171717; font-size: 16px; font-weight: 700; }
.presence-cover.is-mode { background: var(--m-bg); }
.presence-cover.is-mode > span { color: var(--m-ink); }
.link-contact:has(> .presence-cover:not([hidden])) > span:not([class]),
.link-contact:has(> .presence-cover:not([hidden])) > .link-chat-meta,
.link-contact:has(> .presence-cover:not([hidden])) > .link-hobbies { display: none; }
/* Seen: a small pill after the name (tap a thought's to read it again). */
.presence-pill { display: inline-flex; align-items: center; gap: 3px; max-width: 150px; height: 20px; margin-left: 6px; padding: 0 8px 0 6px; overflow: hidden; border-radius: 99px; background: #f2f2f0; color: #8a8a86; font-size: 11.5px; font-weight: 500; vertical-align: 1px; cursor: pointer; }
.presence-pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The name stays on one line; the pill gives way. */
.link-contact > span:has(> strong > .presence-pill) { display: grid; min-width: 0; }
.link-contact strong:has(> .presence-pill) { display: flex; align-items: center; min-width: 0; white-space: nowrap; }
.link-contact strong > .presence-pill { flex: 0 1 auto; min-width: 0; }
.presence-pill.is-mode { background: var(--m-bg); color: var(--m-ink); font-weight: 600; cursor: inherit; }

/* ---------- Contacts ---------- */
.main-chat-page.is-contacts .circle-chat-slot,
.main-chat-page.is-contacts .meet-chat-group,
.main-chat-page.is-contacts [data-live-people] { display: none !important; }
.friends-contacts[hidden] { display: none; }
.friends-letter { margin: 14px 4px 6px; color: #8a8a86; font-size: 12.5px; font-weight: 700; }
.friends-contacts .friends-letter:first-child { margin-top: 4px; }

/* ---------- Meetups and groups: cards 8px apart, like Circle ---------- */
.main-chat-page .circle-card { margin-bottom: 8px; }
.main-chat-page .meet-chat-group { display: grid; gap: 8px; margin: 0 0 18px; }
/* Each card stands alone: not inside the one white rounded list box of the old Friends page
   (desktop.css), which cut off the cards' edges and shadows. */
.main-chat-page .meet-chat-group .chat-page-list { gap: 8px; overflow: visible; border-radius: 0; background: none; }
.main-chat-page .cl-item { border-radius: 16px; box-shadow: 0 0 0 1px #ecebe6, 0 2px 8px rgb(0 0 0 / .04); }
.main-chat-page .cl-row { border: 0; border-radius: 16px; }
/* The swipe buttons stay out of sight until a row slides (they showed at the round corners). */
.main-chat-page .cl-item:not(.open):not(.dragging) .cl-acts { visibility: hidden; }

/* ---------- Cards and sheets ---------- */
.presence-layer { position: fixed; z-index: 1300; top: var(--app-top, 0); left: 0; right: 0; height: var(--app-height, 100%); }
.presence-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .32); animation: presenceFade .18s ease; }
.presence-layer.is-quick .presence-scrim { background: transparent; }
@keyframes presenceFade { from { opacity: 0; } }
.presence-card { position: absolute; left: 16px; right: 16px; top: 50%; max-width: 420px; margin: 0 auto; padding: 18px 18px 16px; border-radius: 28px; background: #fff; color: #171717; box-shadow: 0 20px 50px rgb(0 0 0 / .2); transform: translateY(-50%); animation: presenceCenterIn .28s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes presenceCenterIn { from { opacity: 0; transform: translateY(-50%) scale(.9); } to { opacity: 1; transform: translateY(-50%) scale(1); } }
.presence-card-close { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: #f2f2f0; color: #6c6d67; cursor: pointer; }
.presence-head { display: flex; align-items: center; gap: 11px; padding-right: 36px; }
.presence-head strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.presence-head small { display: block; margin-top: 1px; color: #8a8a86; font-size: 12.5px; }
.presence-card-face, .presence-sheet-face { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--circle-avatar, #4b7966) center / cover; color: #fff; font-size: 15px; font-weight: 800; }
.presence-card-face { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #f7c74b; }
.presence-moon { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: #fff4dc; color: #b45309; }
.presence-bubble { position: relative; display: block; margin-top: 14px; padding: 16px 16px 26px; border-radius: 22px 22px 22px 8px; background: linear-gradient(135deg, #fff4ea, #eef8fc); }
.presence-bubble textarea { display: block; width: 100%; min-height: 84px; padding: 0; border: 0; background: none; color: #2b2520; font: inherit; font-size: 20px; font-weight: 600; line-height: 1.35; resize: none; outline: none; }
.presence-bubble textarea::placeholder { color: #b9ab9b; font-weight: 500; }
.presence-bubble small { position: absolute; right: 14px; bottom: 9px; color: #a99a88; font-size: 11.5px; }
.presence-main { width: 100%; height: 50px; margin-top: 14px; border: 0; border-radius: 25px; background: #171717; color: #fff; font: inherit; font-size: 16px; font-weight: 650; cursor: pointer; }
.presence-main:disabled { opacity: .3; }
.presence-quiet { width: 100%; height: 40px; margin-top: 4px; border: 0; background: none; color: #b42318; font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.presence-tiles { margin-top: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.presence-tiles .presence-tile { height: 66px; padding: 0 4px; align-items: center; text-align: center; }
.presence-tiles .presence-tile b { font-size: 12.5px; }
.presence-tile { height: 74px; padding: 0 14px; border: 1.5px solid transparent; border-radius: 18px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; background: var(--m-bg); color: #2b2b28; font: inherit; text-align: left; cursor: pointer; transition: transform .12s, border-color .12s; }
.presence-tile:active { transform: scale(.97); }
.presence-tile i { font-size: 24px; font-style: normal; line-height: 1; }
.presence-tile b { font-size: 14.5px; font-weight: 650; }
.presence-tile[aria-pressed="true"] { border-color: #171717; box-shadow: 0 4px 12px rgb(0 0 0 / .08); }
.presence-for-head { margin: 16px 2px 8px; display: flex; align-items: baseline; justify-content: space-between; }
.presence-for-head span { color: #4a4a46; font-size: 13px; font-weight: 650; }
.presence-for-head small { color: #b45309; font-size: 12.5px; font-weight: 600; }
.presence-seg { padding: 3px; border-radius: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: #f2f2f0; }
.presence-seg button { height: 34px; padding: 0; border: 0; border-radius: 11px; background: none; color: #5b5b57; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.presence-seg button[aria-pressed="true"] { background: #fff; color: #171717; box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.presence-note { margin-top: 10px; height: 44px; padding: 0 14px; border-radius: 14px; display: flex; align-items: center; gap: 9px; background: #f7f7f5; box-shadow: inset 0 0 0 1px #ecebe6; color: #9a9a96; }
.presence-note svg { flex: none; }
.presence-note input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: #171717; font: inherit; font-size: 16px; outline: none; }
.presence-preview { margin-top: 12px; padding: 10px 12px; border-radius: 14px; background: #fff7e6; text-align: center; }
.presence-preview[hidden] { display: none; }
.presence-preview small { display: block; color: #a8874a; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.presence-preview p { margin: 3px 0 0; color: #7a4d00; font-size: 13.5px; line-height: 1.35; }

/* A friend's thought: a sheet from the bottom with a reply box. */
.presence-sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: #fff; color: #171717; animation: presenceUp .26s cubic-bezier(.2, .9, .3, 1); }
@keyframes presenceUp { from { transform: translateY(100%); } }
.presence-grab { width: 38px; height: 5px; margin: 0 auto 16px; border-radius: 3px; background: #dcdcd8; }
.presence-thought-text { margin: 18px 0 0; padding: 18px; border-radius: 18px; background: linear-gradient(135deg, #fff4ea, #eef8fc); font-size: 20px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.presence-reply { margin-top: 16px; display: flex; gap: 8px; }
.presence-reply input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: #f2f2f0; color: #171717; font: inherit; font-size: 16px; outline: none; }
.presence-reply button { height: 44px; padding: 0 18px; border: 0; border-radius: 22px; background: #171717; color: #fff; font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; }
.presence-hint { margin: 10px 2px 0; color: #8a8a86; font-size: 12.5px; }

/* The quick card under your mode chip. */
.presence-quick { position: absolute; right: 14px; width: min(272px, calc(100% - 28px)); padding: 14px; border-radius: 20px; background: #fff; color: #171717; box-shadow: 0 14px 36px rgb(0 0 0 / .16), 0 0 0 1px rgb(0 0 0 / .04); transform-origin: 70% 0; animation: presenceDrop .22s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes presenceDrop { from { opacity: 0; transform: translateY(-6px) scale(.96); } }
.presence-quick-head { display: flex; align-items: center; gap: 10px; }
.presence-quick-head > span:last-child { min-width: 0; display: grid; gap: 1px; }
.presence-quick-head strong { overflow: hidden; font-size: 15.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.presence-quick-head small { color: #8a8a86; font-size: 12.5px; }
.presence-quick-emoji { flex: none; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--m-bg); font-size: 20px; }
.presence-quick-bar { height: 5px; margin: 12px 0; border-radius: 3px; overflow: hidden; background: #f0efec; }
.presence-quick-bar i { display: block; height: 100%; border-radius: 3px; background: var(--m-ring); }
.presence-quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.presence-quick-actions button { height: 36px; padding: 0; border: 0; border-radius: 12px; background: #f4f4f2; color: #171717; font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; }
.presence-quick-actions .is-end { background: #fdeef0; color: #b42318; }

/* ---------- In a chat: their mode under the name, and above the message box ---------- */
#titleButton.has-mode-tag { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.15; }
.chat-mode-tag { max-width: 100%; height: 19px; padding: 0 8px; overflow: hidden; border-radius: 99px; background: var(--m-bg); color: var(--m-ink); font-size: 11.5px; font-weight: 600; line-height: 19px; text-overflow: ellipsis; white-space: nowrap; }
.chat-mode-notice { margin: 0 12px 8px; padding: 9px 14px; border-radius: 14px; background: var(--m-bg); color: var(--m-ink); font-size: 13.5px; line-height: 1.4; text-align: center; }
.chat-mode-notice small { display: block; opacity: .75; font-size: 12px; }

/* ---------- Dark ---------- */
html:is(.is-dark, [data-profile-theme="dark"]) .friends-title { color: #f2f3f5; }
html:is(.is-dark, [data-profile-theme="dark"]) .friends-tools,
html:is(.is-dark, [data-profile-theme="dark"]) .presence-card,
html:is(.is-dark, [data-profile-theme="dark"]) .presence-sheet,
html:is(.is-dark, [data-profile-theme="dark"]) .presence-quick { background: #171a20; color: #f2f3f5; box-shadow: 0 0 0 1px #2a2e36; }
html:is(.is-dark, [data-profile-theme="dark"]) .friends-tool { color: #f2f3f5; }
html:is(.is-dark, [data-profile-theme="dark"]) .presence-cover b { color: #171717; }
