/* 💬 Bud Chats, iPhone Messages style (update 349, Ryan: "need to improve the look of messanger want something more like iPhone
   messages"). Loaded after style.css in both apps. Your bubbles on the right in solid blue, theirs on the left in gray, the tail on
   the last bubble of a run, tapbacks on the corner, a round ＋ and ↑, round photos and blue dots in the list. No hex colors. */
.chat-ov{
  --im-mine: hsl(211 100% 40%); --im-mine-ink: hsl(0 0% 100%);
  --im-theirs: hsl(240 6% 91%); --im-theirs-ink: hsl(240 6% 10%);
  --im-bg: var(--surface-solid, var(--bg)); --im-blue: hsl(211 100% 42%); --im-sep: color-mix(in srgb, var(--ink) 9%, transparent);
}
:root[data-tone="dark"] .chat-ov, :root[data-woods]:not([data-tone="light"]) .chat-ov{ --im-theirs: hsl(240 4% 23%); --im-theirs-ink: hsl(0 0% 97%); --im-blue: hsl(211 100% 62%); }
@media (prefers-color-scheme: dark){ :root:not([data-tone="light"]) .chat-ov{ --im-theirs: hsl(240 4% 23%); --im-theirs-ink: hsl(0 0% 97%); --im-blue: hsl(211 100% 62%); } }
.chat-box{background:var(--im-bg)}
.chat-main,.chat-msgs{background:var(--im-bg)}
.chat-msgs{padding:10px 14px 14px;gap:1px}

/* ---- the conversation list ---- */
.chat-side{background:var(--im-bg)}
.chat-list{padding:0}
.c-rowwrap{position:relative;overflow:hidden;border-bottom:1px solid var(--im-sep)}
.c-rowwrap.pinned{background:color-mix(in srgb, var(--im-blue) 5%, transparent)}
.c-row{position:relative;z-index:1;border-radius:0;padding:10px 40px 10px 22px;gap:12px;background:var(--im-bg);transition:transform .2s ease}
.c-rowwrap.pinned .c-row{background:color-mix(in srgb, var(--im-blue) 5%, var(--im-bg))}
.c-row:hover{background:color-mix(in srgb, var(--ink) 5%, var(--im-bg))}
.c-row.on{background:color-mix(in srgb, var(--im-blue) 12%, var(--im-bg));box-shadow:none}
.c-row .c-av{width:48px;height:48px;font-size:1rem}
.c-row .c-mid b{font-size:1rem;font-weight:600}
.c-row.unread .c-mid b{font-weight:800}
.c-row .c-last{font-size:.9rem;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.25}
.c-row .c-end{align-self:flex-start;padding-top:2px}
.c-row .c-end small{font-size:.8rem}
.c-row.unread .c-end small{color:var(--im-blue);font-weight:600}
.c-dot{position:absolute;left:7px;top:50%;width:10px;height:10px;margin-top:-5px;border-radius:50%;background:var(--im-blue)}
.c-row .c-unread{display:none}
.c-rowacts{position:absolute;inset:0 0 0 auto;display:flex;z-index:0}
.c-ract{border:0;width:76px;color:hsl(0 0% 100%);font:600 .85rem var(--body);cursor:pointer}
.c-ract.pin{background:hsl(35 95% 38%)} .c-ract.hide{background:hsl(250 30% 40%)}
.c-rowwrap.open .c-row{transform:translateX(-152px)}
.c-rowmore{position:absolute;right:6px;top:50%;transform:translateY(-50%);z-index:2;width:30px;height:30px;border-radius:50%;border:1px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer;opacity:0;transition:opacity .15s}
.c-rowwrap:hover .c-rowmore,.c-rowmore:focus-visible,.c-rowwrap.open .c-rowmore{opacity:1}
@media (hover:none){.c-rowmore{display:none}}
.c-hiddenrow{display:block;width:100%;border:0;background:none;color:var(--im-blue);font:600 .9rem var(--body);padding:14px;cursor:pointer}

/* ---- bubbles ---- */
.c-msg{margin-top:1px;max-width:78%}
.c-msg.tail{margin-bottom:6px}
.c-msg .c-av{width:28px;height:28px}
.c-bubble{background:var(--im-theirs);color:var(--im-theirs-ink);border:0;border-radius:19px;padding:7px 13px 8px;gap:2px;line-height:1.32}
.c-msg.mine .c-bubble{background:var(--im-mine);color:var(--im-mine-ink);border:0;border-radius:19px}
.c-msg:not(.mine).grouped .c-bubble{border-top-left-radius:6px}
.c-msg:not(.mine):not(.tail) .c-bubble{border-bottom-left-radius:6px}
.c-msg.mine.grouped .c-bubble{border-top-right-radius:6px}
.c-msg.mine:not(.tail) .c-bubble{border-bottom-right-radius:6px}
/* the tail: a little curl under the last bubble of a run */
.c-bubble{isolation:isolate}
.c-msg.tail .c-bubble::before,.c-msg.tail .c-bubble::after{content:"";position:absolute;bottom:0;height:18px;pointer-events:none;z-index:-1}
.c-msg.tail:not(.mine) .c-bubble::before{left:-7px;width:18px;background:var(--im-theirs);border-bottom-right-radius:15px 13px}
.c-msg.tail:not(.mine) .c-bubble::after{left:-10px;width:10px;background:var(--im-bg);border-bottom-right-radius:10px}
.c-msg.tail.mine .c-bubble::before{right:-7px;width:18px;background:var(--im-mine);border-bottom-left-radius:15px 13px}
.c-msg.tail.mine .c-bubble::after{right:-10px;width:10px;background:var(--im-bg);border-bottom-left-radius:10px}
.c-name{color:var(--muted);font-size:.74rem;font-weight:600;margin:0 0 1px}
.c-msg:not(.mine) .c-name{position:absolute;top:-17px;left:12px;white-space:nowrap}
.c-msg:not(.mine):not(.grouped){margin-top:18px}
.c-time{font-size:.66rem;opacity:.75}
.c-msg:not(.tail) .c-time{display:none}
.c-day{background:none;color:var(--muted);font-weight:600;font-size:.74rem;margin:14px 0 6px;padding:0}
.c-msg.mine .c-link{color:inherit;text-decoration:underline}
.c-img img{border-radius:14px}
.c-bubble:has(> .c-img:only-of-type),.c-bubble.has-loc{padding:3px}
.c-bubble.has-loc .c-time{padding:0 10px 4px}
.c-seen{color:var(--muted);font-size:.7rem;font-weight:600;margin:-2px 4px 6px}
/* tapbacks on the bubble's top corner */
.c-rx{position:absolute;top:-14px;right:-6px;display:flex;gap:2px;z-index:3}
.c-rx.mine{right:auto;left:-6px}
.c-rxchip{background:var(--surface-solid, var(--surface));color:var(--ink);border:2px solid var(--im-bg);border-radius:999px;padding:1px 7px;font-size:.78rem;box-shadow:0 1px 3px rgb(0 0 0 / .18);cursor:pointer}
.c-rxchip.on{background:var(--im-blue);color:hsl(0 0% 100%)}
.c-msg:has(.c-rx){margin-top:14px}
.c-rxextra{display:flex;gap:2px;border-left:1px solid var(--line);margin-left:4px;padding-left:4px}
/* "…" typing */
.c-typing{display:flex;align-items:center;gap:8px;padding:2px 16px 6px;background:var(--im-bg)}
.c-tybub{display:inline-flex;gap:4px;align-items:center;background:var(--im-theirs);border-radius:18px;padding:10px 13px}
.c-tybub i{width:7px;height:7px;border-radius:50%;background:color-mix(in srgb, var(--im-theirs-ink) 45%, transparent);animation:c-ty 1.2s infinite ease-in-out}
.c-tybub i:nth-child(2){animation-delay:.15s}.c-tybub i:nth-child(3){animation-delay:.3s}
@keyframes c-ty{0%,60%,100%{transform:translateY(0);opacity:.5}30%{transform:translateY(-4px);opacity:1}}
@media (prefers-reduced-motion: reduce){.c-tybub i{animation:none}}

/* ---- the message bar: round ＋, a pill box, round ↑ (phones and computers) ---- */
.chat-compose{flex-wrap:wrap;gap:8px;align-items:flex-end;background:var(--im-bg);border-top:1px solid var(--im-sep)}
.chat-compose .c-more{display:grid;place-items:center;order:2;width:34px;height:34px;margin-bottom:4px;background:color-mix(in srgb, var(--ink) 9%, transparent);font-size:20px}
.chat-compose .c-field{order:3;flex:1 1 0;min-width:0}
.chat-compose .c-ptt{order:4;width:38px;height:38px}.chat-compose .c-send{order:5}
.chat-compose.has-text .c-ptt{display:none}
.chat-compose .c-photo,.chat-compose .c-emo,.chat-compose .c-meme,.chat-compose .c-gif,.chat-compose .c-loc,.chat-compose .c-pin,.chat-compose .c-rw{display:none}
.chat-compose.tools-open .c-photo,.chat-compose.tools-open .c-emo,.chat-compose.tools-open .c-meme,.chat-compose.tools-open .c-gif,.chat-compose.tools-open .c-rw,.chat-compose.tools-open .c-loc,.chat-compose.tools-open .c-pin{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;order:0;flex:1 1 0;min-width:52px;width:auto;height:58px;border-radius:12px;background:var(--sunk);font-size:22px;border:0;color:var(--ink);cursor:pointer}
.chat-compose.tools-open .c-photo::after,.chat-compose.tools-open .c-tool::after{content:attr(data-lab);font-size:11px;font-weight:600;color:var(--muted)}
.chat-compose.tools-open .c-ptt::after{content:none}
.chat-compose.tools-open .c-ptt{order:4;flex:none;width:38px;height:38px;background:none;border-radius:50%}
.chat-compose.tools-open::after{content:"";order:1;flex-basis:100%;height:0}
.c-field textarea{border-radius:20px;padding:8px 14px;min-height:38px;background:var(--im-bg);border:1px solid color-mix(in srgb, var(--ink) 20%, transparent)}
.c-send{width:34px;height:34px;margin-bottom:2px;background:var(--im-mine);color:var(--im-mine-ink)}
.chat-compose:not(.has-text) .c-send{opacity:.45}
.c-hbtn{width:36px;height:36px;border-radius:50%;border:1px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer;font-size:16px;flex:none}
.c-locbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 14px;background:color-mix(in srgb, var(--im-blue) 10%, var(--im-bg));border-top:1px solid var(--im-sep);font-size:.9rem}
.c-locbar span{flex:1 1 220px}

/* ---- search, photos, remind me ---- */
.c-findbar{padding:8px 12px;border-bottom:1px solid var(--im-sep);background:var(--im-bg);display:flex;flex-direction:column;gap:6px;max-height:45%;overflow:auto}
.c-findbar .row{display:flex;gap:8px}.c-findbar input{flex:1}
.c-findres{display:flex;flex-direction:column;gap:4px}
.c-findit{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;border:1px solid var(--line);border-radius:10px;padding:8px 10px;background:var(--surface);color:var(--ink);cursor:pointer;font:inherit}
.c-findit span{font-size:.9rem;color:var(--muted)}
.c-gal{position:absolute;inset:0;z-index:20;background:hsl(0 0% 4% / .96);display:grid;grid-template-columns:56px 1fr 56px;grid-template-rows:1fr auto;align-items:center;justify-items:center;outline:none}
.c-gal img{grid-column:2;max-width:100%;max-height:calc(100vh - 120px);object-fit:contain;border-radius:8px;touch-action:pan-y;user-select:none}
.c-galnav{width:44px;height:44px;border-radius:50%;border:0;background:hsl(0 0% 100% / .16);color:hsl(0 0% 100%);font-size:28px;cursor:pointer}
.c-galnav:disabled{opacity:.25}
.c-galcap{grid-column:1/-1;color:hsl(0 0% 88%);padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px))}
.c-galx{position:absolute;top:calc(10px + env(safe-area-inset-top,0px));right:12px;background:hsl(0 0% 100% / .16);color:hsl(0 0% 100%);border:0}
.c-remind{position:absolute;left:12px;right:12px;bottom:80px;z-index:15;box-shadow:0 10px 30px rgb(0 0 0 / .3)}
.c-remgrid{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.chat-main{position:relative}

/* ---- 📍 / 📌 map cards and the pin picker (pins.js) ---- */
.pn-card{display:flex;flex-direction:column;gap:6px;width:min(260px,70vw);background:var(--surface-solid, var(--surface));color:var(--ink);border-radius:14px;overflow:hidden}
.pn-mini{position:relative;height:120px;overflow:hidden;background:hsl(100 15% 88%)}
.pn-tiles{position:absolute;left:50%;top:50%;width:768px;height:768px;transform:translate(calc(-1 * var(--px)), calc(-1 * var(--py)))}
.pn-tiles img{position:absolute;width:256px;height:256px}
.pn-dot{position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-9px 0 0 -9px;border-radius:50%;background:var(--im-blue, hsl(211 100% 42%));border:3px solid hsl(0 0% 100%);box-shadow:0 1px 4px rgb(0 0 0 / .4)}
.pn-card.pin .pn-dot{border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:hsl(5 75% 46%);margin-top:-20px}
.pn-credit{position:absolute;right:4px;bottom:2px;font-size:9px;background:hsl(0 0% 100% / .8);color:hsl(0 0% 20%);padding:0 3px;border-radius:3px}
.pn-tx{display:flex;flex-direction:column;gap:2px;padding:0 10px}
.pn-tx small{color:var(--muted)}
.pn-go{display:flex;flex-wrap:wrap;gap:6px;padding:0 10px 10px}
.pn-ov{position:fixed;inset:0;z-index:9700;background:rgb(0 0 0 / .5);display:grid;place-items:center;padding:12px}
.pn-box{width:min(560px,100%);max-height:calc(100vh - 24px);overflow:auto}
.pn-head{justify-content:space-between;align-items:center}
.pn-map{height:min(52vh,380px);border-radius:12px;overflow:hidden;border:1px solid var(--line)}
.pn-acts{justify-content:flex-end;gap:8px}
.pn-save{align-items:flex-start;gap:8px;font-size:.9rem}
.pn-row{display:flex;align-items:center;gap:8px;padding:10px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.pn-rowtx{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
.pn-rowtx small{overflow-wrap:anywhere}
.fd-pinrow{gap:8px}
@media (max-width:760px){ .c-msg{max-width:84%} .c-row{padding-left:20px} }
.c-msg.mine .c-time{opacity:.92}
.c-findbar,.c-typing,.c-locbar,.c-replybar{flex:none}

/* 📋 update 352: message words can always be selected and copied */
.c-bubble .c-text{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
