/* Chats — list, thread, two-pane desktop. Builds on m2c.css tokens/components. */

/* ---------- List (mobile-first) ---------- */
.chat-list-body{display:flex;flex-direction:column;gap:18px;padding:4px 0 calc(var(--tabbar-h) + var(--sa-bottom) + 28px)}
.chat-search{margin:0 20px}
.new-matches{display:flex;flex-direction:column;gap:10px}
.nm-title{padding:0 20px}
.nm-strip{display:flex;gap:16px;padding:4px 20px 6px;overflow-x:auto;scrollbar-width:none;overscroll-behavior-x:contain}
.nm-strip::-webkit-scrollbar{display:none}
.nm-item{display:flex;flex-direction:column;align-items:center;gap:6px;width:76px;flex:none;text-decoration:none;color:inherit;border-radius:var(--r-md);padding:2px 0}
.nm-item .t-small{font-weight:600;max-width:76px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nm-item .avatar .online{box-shadow:0 0 0 3px var(--bg)}
.nm-discover .avatar{border-radius:50%;display:grid;place-items:center;background:var(--surface-2);box-shadow:inset 0 0 0 1.5px var(--border-strong);color:var(--primary-text)}
.conv-section{display:flex;flex-direction:column}
.conv-title{padding:0 20px 6px}
.conv-row{padding:10px 20px;transition:background-color var(--dur-2) var(--ease-standard)}
.conv-row:hover{background:color-mix(in srgb,var(--surface-2) 60%,transparent)}
.conv-row[aria-current="true"]{background:var(--primary-soft)}
.conv-row .online{box-shadow:0 0 0 3px var(--bg)}
.conv-row[aria-current="true"] .online{box-shadow:0 0 0 3px var(--primary-soft)}
.conv-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.conv-row .v-tick{flex:none}
.conv-row .streak{margin-left:4px;flex:none}
.conv-row .row-sub .ms{font-size:16px;vertical-align:-3px}
.conv-row.is-new{display:none}
.conv-sk{cursor:default}
.conv-sk:hover{background:none}
.conv-none{padding:12px 20px}
.conv-more{display:flex;justify-content:center;padding:16px;color:var(--text-2)}
.chat-empty{flex:1;justify-content:center;min-height:60vh}
.empty-heart{position:absolute;right:-10px;top:-8px;width:40px;height:40px;border-radius:14px;background:var(--surface);box-shadow:var(--shadow-2);display:grid;place-items:center;color:var(--primary)}

/* ---------- Thread (mobile: the document scrolls, header sticky, composer fixed) ----------
   Document scrolling (not an inner pane) keeps the Android app's native pull-to-refresh
   from firing while you scroll back through history. */
.chat-thread-pane{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh;background:var(--bg-tint)}
.chat-placeholder{display:none}
body.thread-open{background:var(--bg-tint)}
html:has(body.thread-open){background:var(--bg-tint)}
@media (max-width:1023.98px){
  body.thread-open .chat-list-pane{display:none}
  body.thread-open .tabbar{display:none}
  body.thread-open .toast-slot{bottom:calc(var(--composer-h,64px) + 14px)}
}
.thread-head{gap:4px;box-shadow:0 1px 0 var(--border);background:color-mix(in srgb,var(--bg) 92%,transparent);padding-right:6px}
.thread-who{display:flex;align-items:center;gap:10px;flex:1;min-width:0;text-decoration:none;color:inherit;border-radius:var(--r-md);padding:2px 4px}
.thread-who .row-title{gap:4px}
.thread-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.thread-who .streak{flex:none;margin-left:2px}
.thread-status{color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.thread-status.is-online{color:var(--online-text)}
.thread-profile-btn{display:none}
.menu-wrap{position:relative}
.thread-menu{position:absolute;right:0;top:calc(100% + 6px);width:230px;z-index:42;box-shadow:var(--shadow-3),inset 0 0 0 1px var(--border);animation:fade-up var(--dur-2) var(--ease-out)}
.thread-menu .row{min-height:48px}
#thread-menu-btn[aria-expanded="true"]{background:var(--surface-2)}

.thread-scroll{flex:1;display:flex;flex-direction:column;justify-content:flex-end;padding-bottom:calc(var(--composer-h,64px) + 4px)}
.thread{padding:12px 16px 8px;overflow-anchor:none}
.thread-older{display:flex;justify-content:center;padding:12px;color:var(--text-2)}
.thread-typing{display:flex;padding:0 16px 8px}
.msg{white-space:pre-wrap}
.msg-row{display:flex;align-items:center;gap:4px;max-width:min(80%,560px)}
.msg-row > .msg{max-width:100%;min-width:0}
.msg-row.in{align-self:flex-start}
.msg-row.out{align-self:flex-end;flex-direction:row-reverse}
.msg-row.tail-gap{margin-top:10px}
.msg-row.has-react{margin-bottom:14px}
.msg .react{cursor:pointer;border:0}
.msg-react-btn{width:36px;height:36px;border-radius:50%;border:0;background:transparent;color:var(--text-2);display:grid;place-items:center;cursor:pointer;opacity:0;transition:opacity var(--dur-2);flex:none}
.msg-row:hover .msg-react-btn,.msg-react-btn:focus-visible{opacity:1}
.msg-react-btn:hover{background:var(--surface-2);color:var(--text)}
@media (hover:none){.msg-react-btn{display:none}.thread .msg{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}}
.msg-img{border:0;display:block;cursor:zoom-in;background:var(--surface-3)}
.msg-img.in{background:var(--surface-3)}
.msg-img img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:inherit}
.msg-img .react{z-index:3}
.msg.is-pending{opacity:.7}
.msg.is-failed{opacity:.7;box-shadow:inset 0 0 0 2px var(--danger)}
.msg-meta .ms{font-size:16px}
.msg-meta.failed{color:var(--danger-text)}
.msg-meta .text-link{min-height:32px;color:inherit}
.seen-ic{color:var(--verified)}
.thread .wyr{margin:12px 0}
.wyr-opt:disabled{cursor:default}
.wyr-opt .who .avatar > .ph{box-shadow:0 0 0 2px var(--surface)}
.wyr-opt .wyr-letter{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;flex:none;background:var(--surface);font:700 12px/1 var(--font-body);color:var(--lilac-text);box-shadow:inset 0 0 0 1.5px var(--lilac-soft)}
.wyr-foot{font:500 13px/18px var(--font-body);color:var(--text-2)}

.thread-intro{flex:1;display:flex;flex-direction:column;justify-content:center;gap:18px;padding:20px 4px}
.intro-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:10px}
.intro-pair{position:relative;width:132px;height:76px}
.intro-pair .avatar{position:absolute;top:0}
.intro-pair .avatar:first-child{left:0}
.intro-pair .avatar:last-child{right:0}
.intro-pair .avatar > .ph{box-shadow:0 0 0 3px var(--bg-tint)}
.intro-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}
.btn-lilac{background:var(--lilac-soft);color:var(--lilac-text)}

/* Composer */
.composer-wrap{position:fixed;left:0;right:0;bottom:0;z-index:20;display:flex;flex-direction:column}
.composer{align-items:flex-end}
.composer-field{gap:8px;padding:0 6px 0 16px;cursor:text}
.composer-field:focus-within{box-shadow:inset 0 0 0 1.5px var(--primary-fill),0 0 0 4px var(--primary-soft-2)}
.composer-field textarea{flex:1;min-width:0;border:0;background:transparent;resize:none;outline:none;color:var(--text);font:400 16px/22px var(--font-body);padding:11px 0;max-height:132px;overflow-y:auto}
.composer-field textarea::placeholder{color:var(--text-2)}
.composer-hint{display:none;font:500 12px/1 var(--font-body);color:var(--text-2);white-space:nowrap;padding-bottom:16px;align-self:flex-end}
.send-btn{transition:transform var(--dur-1) var(--ease-standard),opacity var(--dur-2)}
.send-btn:active{transform:scale(.92)}
.send-btn:disabled{opacity:.45;cursor:not-allowed}
.img-preview{display:flex;align-items:center;gap:12px;margin:0 10px 6px;padding:8px 8px 8px 10px;border-radius:var(--r-lg);background:var(--surface);box-shadow:var(--shadow-2),inset 0 0 0 1px var(--border)}
.img-preview img{width:52px;height:52px;border-radius:12px;object-fit:cover;flex:none}
.jump-btn{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--composer-h,64px) + 12px);z-index:21;display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 16px;border:0;border-radius:var(--r-pill);background:var(--inverse-bg);color:var(--inverse-text);font:600 14px/1 var(--font-body);box-shadow:var(--shadow-3);cursor:pointer;animation:jump-in var(--dur-3) var(--ease-out)}
@keyframes jump-in{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%,0)}}

/* Report options as real radios */
.report-reasons{border:0;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.report-reasons .option input{position:absolute;opacity:0;width:1px;height:1px;pointer-events:none}
.report-reasons .option:has(input:checked){background:var(--primary-soft);box-shadow:inset 0 0 0 2px var(--primary)}
.report-reasons .option:has(input:checked) .dot{box-shadow:inset 0 0 0 7px var(--primary-fill)}
.report-reasons .option:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:2px}

/* Streak sheet */
.streak-levels .row{cursor:default;min-height:52px}
.streak-emoji{font-size:20px}

/* Milestone celebration */
.milestone-sheet{align-items:center;text-align:center;gap:14px}
.milestone-art{position:relative;width:112px;height:112px;margin-top:10px}
.milestone-glow{position:absolute;inset:-14px;border-radius:50%;background:radial-gradient(circle,rgba(242,176,74,.38) 0%,transparent 70%)}
.milestone-tile{position:absolute;inset:0;border-radius:36px;background:var(--streak-soft);box-shadow:inset 0 0 0 2px var(--streak);display:grid;place-items:center;font-size:56px;line-height:1}
.milestone-progress{width:100%;display:flex;flex-direction:column;gap:6px;text-align:left}
.milestone-progress .progress > i{background:linear-gradient(90deg,#F2B04A,#FF9E8C)}

/* Image viewer */
.img-viewer{color:#fff;display:flex;flex-direction:column}
.img-viewer:not([open]){display:none}
.img-viewer::backdrop{background:#0E0B10}
.img-viewer-bar{display:flex;align-items:center;gap:8px;padding:calc(var(--sa-top) + 6px) 8px 6px}
.img-viewer-name{font:600 15px/20px var(--font-body)}
.img-viewer-time{font:500 13px/18px var(--font-body);color:rgba(255,255,255,.75)}
.img-viewer-stage{flex:1;min-height:0;position:relative}
.img-viewer-stage img{position:absolute;inset:0;margin:auto;max-width:calc(100% - 16px);max-height:calc(100% - 16px);object-fit:contain;border-radius:6px}
.img-viewer-foot{display:flex;justify-content:center;padding:12px 12px calc(var(--sa-bottom) + 22px)}
.img-viewer-react{background:rgba(40,30,44,.85);box-shadow:none}
.img-viewer-react button{color:#fff}
.img-viewer-react button.on{background:rgba(255,255,255,.16)}
dialog.sheet.img-viewer{background:#0E0B10;color:#fff;inset:0;margin:0;width:100%;max-width:none;height:100dvh;max-height:100dvh;padding:0;border-radius:0;animation:fade-in var(--dur-2) var(--ease-standard)}
dialog.sheet.img-viewer.closing{animation:none}

/* Reaction popover (long-press / hover button) */
.react-dialog{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;overflow:hidden}
.react-dialog:not([open]){display:none}
.react-dialog::backdrop{background:var(--scrim);backdrop-filter:blur(3px)}
.react-pop{position:absolute;display:flex;flex-direction:column;gap:10px;align-items:flex-start;max-width:calc(100% - 24px);animation:fade-up var(--dur-2) var(--ease-out)}
.react-pop.out{align-items:flex-end}
.react-preview .msg{box-shadow:var(--shadow-3);transform:scale(1.03);transform-origin:left center;max-width:min(80vw,520px);pointer-events:none}
.react-pop.out .react-preview .msg{transform-origin:right center}
.react-actions{width:200px;box-shadow:var(--shadow-3)}
.react-actions .row{min-height:48px}
.react-bar button{transition:transform var(--dur-1) var(--ease-spring)}
.react-bar button:hover{transform:scale(1.15)}

/* ---------- Desktop: rail + two panes ---------- */
@media (min-width:1024px){
  .chat-main{height:100vh;height:100dvh;min-height:0;overflow:hidden}
  .chat-app{display:flex;flex:1;min-height:0}
  .chat-list-pane{width:360px;flex:none;display:flex;flex-direction:column;min-height:0;background:var(--bg);box-shadow:1px 0 0 var(--border);position:relative;z-index:1}
  .chat-list-head{position:static;padding:28px 20px 6px 24px;background:transparent;backdrop-filter:none}
  .chat-list-head .appbar-title{font:700 var(--fs-h1)/var(--lh-h1) var(--font-display)}
  .chat-list-body{flex:1;min-height:0;overflow-y:auto;padding:6px 8px 16px;gap:12px}
  .chat-search{margin:0 12px 4px}
  .new-matches,.conv-title{display:none!important}
  .conv-row{padding:10px 12px;border-radius:16px}
  .conv-row.is-new{display:flex}
  .conv-row .online{box-shadow:0 0 0 3px var(--bg)}
  .chat-empty{min-height:0;padding:40px 16px}
  .chat-thread-pane{flex:1;min-width:0;min-height:0;height:100%;position:relative}
  .chat-thread-pane:not([hidden]) ~ .chat-placeholder{display:none}
  .chat-thread-pane[hidden] ~ .chat-placeholder{display:flex;flex:1;align-items:center;justify-content:center;background:var(--bg-tint)}
  .thread-head{position:static;padding:16px 24px;gap:12px;background:var(--bg)}
  .thread-back{display:none}
  .thread-who .avatar{width:48px;height:48px}
  .thread-who .row-title{font-size:17px}
  .thread-profile-btn{display:inline-flex}
  #menu-profile{display:none}
  #menu-profile + .row{border-top:0}
  .thread-scroll{flex:1;min-height:0;overflow-y:auto;padding-bottom:0;overscroll-behavior:contain}
  .thread{width:100%;max-width:760px;margin:0 auto;padding:20px 32px}
  .thread-typing{width:100%;max-width:760px;margin:0 auto;padding:0 32px 12px}
  .thread-intro{max-width:560px;margin:0 auto}
  .composer-wrap{position:relative;background:color-mix(in srgb,var(--bg) 94%,transparent);box-shadow:0 -1px 0 var(--border)}
  .composer{width:100%;max-width:808px;margin:0 auto;padding:14px 24px 18px;background:none;box-shadow:none;backdrop-filter:none}
  .composer-hint{display:inline}
  .img-preview{width:calc(100% - 48px);max-width:760px;margin:12px auto 0}
  .jump-btn{position:absolute;bottom:calc(var(--composer-h,80px) + 12px)}
  body.thread-open{background:var(--bg)}
  html:has(body.thread-open){background:var(--bg)}
}

/* Received photos stay blurred until tapped */
.msg-img.is-hidden img{filter:blur(28px) saturate(.6);transform:scale(1.15)}
.msg-img .img-cover{position:absolute;inset:0;z-index:2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;border-radius:inherit;background:rgba(22,14,26,.38);color:#fff;font:600 13px/18px var(--font-body);text-align:center;padding:12px;cursor:pointer}
.img-viewer-report{margin-left:auto;background:rgba(255,255,255,.14);color:#fff;min-height:40px}
.img-viewer-report:hover{background:rgba(255,255,255,.24)}
.composer-field{min-width:0}  /* let the field shrink so the send button stays on screen on 320–360px phones */
