/* Chat: world / clan / private / group conversations, friends, new group (client/chat.js). Prefix: ch-
   Colours, radii, shadows and sizes come from the design tokens in style.css. The frame stays dark and painted like the
   rest of the game; what is read (bubbles, announcement and share cards, the active folder tab) is on paper
   (--ch-paper), because dark-on-light text reads faster in a long conversation. */
.ch-screen { --ch-paper: #f1e2c6; --ch-paper-2: #e3d1ac; --ch-ink: var(--c-parch-ink); --ch-edge: #b79a66; --ch-mine: #cfe6a8; --ch-mine-2: #b2d284; --ch-mine-edge: #7da352; --ch-link: #1c5cb0; }
#sheet { --ch-paper: #f1e2c6; --ch-paper-2: #e3d1ac; --ch-ink: var(--c-parch-ink); --ch-edge: #b79a66; --ch-link: #1c5cb0; }

/* ---------- full-height chat screens (inside #panel) ---------- */
.ch-screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: rgba(12,19,15,.90); z-index: 1; }
.ch-screen > .pn-title { position: relative; top: 0; margin: 0; flex: none; grid-template-columns: 1fr auto; padding-left: 16px; }
.ch-screen > .pn-title .pn-back { display: none; } /* the back button lives in the bottom bar, beside the message field */
.ch-screen > .pn-title h2 { text-align: left; }
.ch-body, .ch-col-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ch-col-pane > .ch-pane { background: rgba(12,19,15,.86); } /* as dark as a conversation, so the base behind does not show through the lists */
.ch-ttl { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; vertical-align: middle; }
.ch-ttl .nm { overflow: hidden; text-overflow: ellipsis; }
.pn-title .pn-right .ch-tool, .ch-tool { position: relative; width: var(--tap-sm); height: var(--tap-sm); padding: 0; border-radius: var(--r-md); display: grid; place-items: center; background: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.5)); border: 1px solid var(--c-rust-4); color: var(--c-amber-pale); font-size: 20px; line-height: 1; box-shadow: var(--bevel); }
.ch-tool .ch-pill { top: -6px; right: -6px; }

/* ---------- chat settings sheet ---------- */
.ch-set-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 2px; border-top: 1px solid rgba(255,255,255,.07); font-size: 14px; }
.ch-set-num { width: 64px !important; text-align: center; font-weight: 900; font-size: 16px; }
.ch-set-box { width: 34px; height: 34px; border-radius: 9px; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: #1c1a10; font-weight: 900; font-size: 18px; }
.ch-set-box.on { background: var(--c-amber); border-color: var(--c-amber); }
.ch-set-lang { min-width: 130px; }

/* ---------- folder tabs: Events | World | Clan | Private ---------- */
.ch-ftabs { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 7px 6px 0; background: var(--surf-steel); border-bottom: 5px solid var(--ch-paper); position: relative; z-index: 2; }
.ch-ftab { position: relative; min-height: 42px; padding: 4px 2px; border-radius: 11px 11px 0 0; border: 1px solid var(--c-line-hi); border-bottom: 0; background: linear-gradient(#27332b, #19221c); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); color: var(--c-text-2); font-size: var(--fs-base); font-weight: 800; letter-spacing: .01em; }
.ch-ftab:active:not(:disabled) { translate: none; }
.ch-ftab.on { background: linear-gradient(#fff3d6, var(--ch-paper)); color: var(--ch-ink); border-color: #fff6de; box-shadow: 0 -2px 8px rgba(240,180,60,.25); min-height: 46px; margin-top: -4px; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.ch-pill { position: absolute; top: -6px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: linear-gradient(#ff6a5c, #c8352b); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 1.5px solid #1a0d0b; box-shadow: 0 2px 4px rgba(0,0,0,.5); font-style: normal; line-height: 1; text-shadow: none; }
.ch-pill.gold, .ch-pill.at { background: linear-gradient(var(--c-amber-pale), #e0a43a); color: #2a1a02; }
.ch-pill.inl { position: static; display: inline-grid; vertical-align: middle; margin-left: 4px; }
.ch-ftab .ch-pill { top: -5px; right: 2px; }
.ch-new { position: absolute; top: -5px; right: 2px; padding: 2px 5px 3px; border-radius: 3px 3px 6px 6px; background: var(--surf-blood); color: #fff; font: 800 9px/1 var(--font); font-style: normal; letter-spacing: .05em; box-shadow: var(--sh-1); text-shadow: none; }
.ch-atb { position: absolute; top: -5px; left: 2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surf-amber); color: var(--c-amber-ink); font: 800 11px/1 var(--font); font-style: normal; border: 1.5px solid #1a0d0b; text-shadow: none; }

/* ---------- clan sub-tabs: Chat | Announcement | Leaders ---------- */
.ch-subtabs { flex: none; display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 4px; margin: 8px 10px 4px; padding: 4px; border-radius: var(--r-lg); background: var(--c-ink); border: 1px solid var(--c-line); box-shadow: var(--well); }
.ch-subtab { position: relative; min-height: 36px; padding: 4px 6px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid transparent; border-radius: var(--r-md); background: none; box-shadow: none; font-size: var(--fs-md); font-weight: 800; color: var(--c-text-2); white-space: nowrap; }
.ch-subtab.on { background: var(--surf-amber); color: var(--c-amber-ink); border-color: #ffe7a6 #e0a030 #9a6414; box-shadow: var(--bevel-hi), var(--sh-1); text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.ch-subtab .lock { font-style: normal; font-size: 11px; opacity: .8; }
.ch-subtab::after { content: ''; position: absolute; inset: -5px 0; } /* 46 px tall for the finger, 36 px for the eye */

/* ---------- room ---------- */
.ch-room { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: radial-gradient(circle at 15% 0%, rgba(240,180,60,.07), transparent 45%), radial-gradient(circle at 100% 100%, rgba(78,143,224,.06), transparent 50%), repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 14px, transparent 14px 28px), rgba(12,19,15,.86); }
.ch-banner { flex: none; display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 13px; background: linear-gradient(90deg, rgba(43,42,64,.95), rgba(22,32,26,.95)); border-bottom: 1px solid #3a3550; }
.ch-banner.sub { justify-content: center; color: var(--muted); font-size: 12px; padding: 5px 12px; background: rgba(0,0,0,.35); border-bottom-color: var(--line); }
.ch-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 6px 10px 12px; -webkit-overflow-scrolling: touch; }
.ch-top { min-height: 4px; }
.ch-more, .ch-begin { text-align: center; font-size: 11px; color: var(--muted); padding: 8px 0 2px; }
.ch-begin { opacity: .7; letter-spacing: .04em; }
.ch-sep { text-align: center; margin: 14px 0 4px; }
.ch-sep span { display: inline-block; font-size: 11px; font-weight: 700; color: var(--c-text-2); background: rgba(0,0,0,.5); border: 1px solid var(--c-line); padding: 2px 12px; border-radius: var(--r-pill); }

.ch-msg { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; animation: chIn .22s ease-out; }
.ch-msg.cont { margin-top: 4px; }
.ch-msg.mine { flex-direction: row-reverse; }
@keyframes chIn { from { opacity: 0; transform: translateY(6px); } }
.ch-av-slot { width: 40px; flex: none; cursor: pointer; }
.ch-msg.mine .ch-av-slot { cursor: default; }
.ch-col { max-width: calc(100% - 52px); min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.ch-msg.mine .ch-col { align-items: flex-end; }
.ch-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; margin: 0 2px 4px; cursor: pointer; max-width: 100%; }
.ch-msg.mine .ch-who { cursor: default; justify-content: flex-end; }
.ch-who .tag { color: var(--c-amber); font-weight: 800; }
.ch-who .nm { font-weight: 700; color: var(--c-text); }
.ch-lv { flex: none; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; display: grid; place-items: center; background: radial-gradient(circle at 35% 25%, #6aa9e6, #1f4d86 75%); border: 1.5px solid #cfe6ff; color: #fff; font: 800 10.5px/1 var(--font); text-shadow: 0 1px 1px rgba(0,0,0,.6); box-shadow: var(--sh-1); }
.ch-role { flex: none; font-size: 13px; line-height: 1; filter: drop-shadow(0 1px 1px #000); }
.ch-vip { font-size: 9px; font-weight: 900; padding: 1px 5px; border-radius: 5px; background: linear-gradient(var(--c-amber-pale), #d9962c); color: #3a2405; letter-spacing: .03em; box-shadow: 0 0 6px rgba(240,180,60,.4); }
.ch-row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.ch-msg.mine .ch-row { flex-direction: row-reverse; }
.ch-bub { position: relative; min-width: 0; padding: 8px 11px; border-radius: 4px 14px 14px 14px; background: linear-gradient(var(--ch-paper), var(--ch-paper-2)); border: 1px solid var(--ch-edge); box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 5px rgba(0,0,0,.45); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.38; color: var(--ch-ink);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ch-msg.cont .ch-bub { border-top-left-radius: 14px; }
.ch-msg.mine .ch-bub { background: linear-gradient(var(--ch-mine), var(--ch-mine-2)); border-color: var(--ch-mine-edge); color: #1d2a10; border-radius: 14px 4px 14px 14px; }
.ch-msg.mine.cont .ch-bub { border-top-right-radius: 14px; }
.ch-msg.at .ch-bub { box-shadow: 0 0 0 2px var(--c-amber), 0 0 12px rgba(240,180,60,.5); }
.ch-msg.flash .ch-bub { animation: chFlash 1.4s ease-out; }
@keyframes chFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--c-amber-hi), 0 0 18px var(--c-amber); } }
.ch-bub.liked { margin-bottom: 11px; }
.ch-bub.gone, .ch-msg.mine .ch-bub.gone { background: rgba(255,255,255,.04); border: 1px dashed #4a5a4e; box-shadow: none; color: #9aa79a; font-size: 13px; font-style: italic; }
.ch-tx { display: inline; }
.ch-at { color: var(--ch-link); font-weight: 800; }
.ch-at.me { background: var(--c-amber); color: var(--c-amber-ink); border-radius: 4px; padding: 0 3px; }
/* reply header inside the bubble */
.ch-re { display: block; width: 100%; margin: 0 0 5px; padding: 3px 7px; text-align: left; border: 0; border-left: 3px solid #a8823f; border-radius: 4px; background: rgba(58,46,34,.1); box-shadow: none; color: rgba(58,46,34,.82); font-size: 12.5px; line-height: 1.3; white-space: normal;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ch-re b { font-weight: 800; color: var(--ch-ink); }
.ch-re.gone { font-style: italic; opacity: .75; }
.ch-msg.mine .ch-re { border-left-color: #5d8236; background: rgba(29,42,16,.1); }
/* like heart on the bubble's corner */
.ch-heart { position: absolute; right: 8px; bottom: -12px; z-index: 1; height: 22px; min-width: 0; padding: 0 7px 0 5px; display: inline-flex; align-items: center; gap: 3px; border-radius: 11px; background: #fffaf0; border: 1px solid #c9b48a; color: #8a7a66; font: 800 11.5px/1 var(--font); box-shadow: var(--sh-1); }
.ch-heart i { display: grid; color: #b9a892; }
.ch-heart.on { border-color: #e58a80; color: #b12c22; background: #ffe9e4; } .ch-heart.on i { color: #e0453a; }
.ch-heart::after { content: ''; position: absolute; inset: -9px -8px; }
.ch-heart.pop, .ch-ann-like.pop { animation: chPop .3s ease-out; }
.ch-msg.mine .ch-heart { right: auto; left: 8px; }
@keyframes chPop { 50% { transform: scale(1.25); } }
/* coordinates typed in a message */
.ch-coord { display: inline-flex; align-items: center; gap: 3px; vertical-align: baseline; padding: 1px 8px 1px 5px; margin: 1px 2px; min-height: 0; border-radius: 8px; background: linear-gradient(#123744, #0b2129); border: 1px solid #3aa6c2; color: #9be8ff; font: 700 12.5px/1.4 var(--font-mono); box-shadow: none; }
.ch-coord i { font-style: normal; font-size: 12px; }

/* share card: a title strip and the coordinates */
.ch-share { display: block; width: 100%; min-width: 196px; max-width: 260px; padding: 0; margin: 0 0 2px; overflow: hidden; text-align: left; border-radius: 9px; border: 1px solid #8b6a35; background: #fbf4e2; color: var(--ch-ink); box-shadow: var(--sh-1); white-space: normal; }
.ch-bub.shr { padding: 5px 5px 7px; } .ch-bub.shr .ch-tx { display: block; padding: 4px 6px 0; }
.ch-share .hd { display: flex; align-items: center; gap: 6px; padding: 5px 9px; background: var(--surf-blue); color: #fff; font-size: 13px; text-shadow: 0 1px 1px rgba(0,0,0,.45); }
.ch-share.k-zombie .hd, .ch-share.k-monster .hd, .ch-share.k-rally .hd { background: var(--surf-blood); }
.ch-share.k-site .hd, .ch-share.k-convoy .hd { background: var(--surf-good); color: #062b0e; text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.ch-share.k-capital .hd, .ch-share.k-territory .hd { background: var(--surf-amber); color: var(--c-amber-ink); text-shadow: 0 1px 0 rgba(255,255,255,.35); }
.ch-share .hd i { font-style: normal; font-size: 15px; }
.ch-share .hd b { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-share .hd em { flex: none; font-style: normal; font-weight: 800; font-size: 11px; background: rgba(0,0,0,.28); border-radius: 6px; padding: 1px 5px; color: #fff; text-shadow: none; }
.ch-share .bd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px 8px; }
.ch-share .bd small { font-size: 11.5px; color: #7a6a52; font-weight: 700; }
.ch-share .xy { font: 800 13.5px/1 var(--font-mono); color: var(--ch-link); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.ch-share-pre { display: grid; justify-items: center; margin: 4px 0 12px; }
.ch-share-btn { flex: none; min-height: var(--tap-sm); padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; border-radius: var(--r-md); background: rgba(0,0,0,.35); border: 1px solid var(--c-amber-lo); color: var(--c-amber-hi); font-size: var(--fs-md); font-weight: 800; }
.ch-share-btn i { display: grid; }
.sheet-head .ch-share-btn { margin-left: auto; margin-right: 6px; }
.ch-ttl .ch-flag { display: none; }

.ch-jump { position: absolute; right: 12px; bottom: 72px; z-index: 3; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surf-amber); color: #2a1a02; border: 1px solid #ffe7a6; box-shadow: 0 4px 12px rgba(0,0,0,.5); }

/* ---------- bottom bar: back, the field with its emoji button, plus / send ---------- */
.ch-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px calc(8px + var(--safe-bottom)); background: var(--surf-wood); border-top: 2px solid var(--c-amber-lo); box-shadow: 0 -4px 12px rgba(0,0,0,.4); }
.ch-backb { flex: none; width: var(--tap); height: var(--tap); padding: 0; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surf-raised); border: 1px solid var(--c-line-hi); color: var(--c-amber-pale); box-shadow: var(--bevel), 0 3px 0 #0a0f0b; }
.ch-field { flex: 1; min-width: 0; min-height: var(--tap); display: flex; align-items: center; gap: 4px; background: var(--c-ink); border: 1px solid #5a4422; border-radius: 22px; padding: 0 4px 0 16px; box-shadow: var(--well); }
.ch-field:focus-within { border-color: var(--c-amber); box-shadow: var(--well), 0 0 0 2px rgba(240,180,60,.2); }
.ch-field.solo { margin-bottom: 4px; border-radius: 14px; padding-right: 12px; }
.ch-input { flex: 1; min-width: 0; height: 42px; padding: 0; background: transparent; border: 0; outline: none; font-size: 15px; box-shadow: none; }
.ch-input:focus-visible { outline: none; }
.ch-search .ch-input, .ch-field .ch-input { border-radius: 0; }
.ch-count { flex: none; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-count.warn { color: var(--bad); font-weight: 800; }
.ch-emo-btn { flex: none; width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 0; background: none; box-shadow: none; font-size: 21px; line-height: 1; filter: saturate(.85); }
.ch-emo-btn.on { background: rgba(240,180,60,.2); filter: none; }
.ch-plus { flex: none; width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--surf-raised); border: 2px solid var(--c-amber-lo); color: var(--c-amber-hi); box-shadow: var(--bevel), 0 3px 0 #0a0f0b; }
.ch-plus.send { background: var(--surf-amber); color: var(--c-amber-ink); border-color: #ffe7a6 #e0a030 #9a6414; box-shadow: var(--bevel-hi), 0 3px 0 var(--c-amber-deep), var(--sh-glow); }
.ch-plus.pop { animation: chPop .3s ease-out; }
.ch-bar-note { flex: 1; min-width: 0; font-size: var(--fs-sm); color: var(--c-rust-6); line-height: 1.3; opacity: .85; }
.ch-bar-btn { flex: 1; min-width: 0; }
button.ch-find { justify-content: flex-start; color: var(--c-faint); font-size: 14.5px; text-align: left; }
button.ch-find span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* strips above the bar: reply, photo, who to mention, emoji */
.ch-photo, .ch-reply { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #141c17; border-top: 1px solid var(--c-line-hi); color: var(--c-text-2); font-size: 13px; }
.ch-photo.hidden, .ch-reply.hidden { display: none; }
.ch-photo img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 2px solid var(--c-amber-lo); }
.ch-photo span, .ch-reply .tx { flex: 1; min-width: 0; }
.ch-reply .ic { flex: none; color: var(--c-amber); font-size: 17px; font-weight: 900; }
.ch-reply .tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--c-amber-lo); padding-left: 8px; }
.ch-reply .tx b { color: var(--c-amber-pale); font-weight: 800; }
.ch-photo-x { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%; }
.ch-pickat { flex: none; max-height: 188px; overflow-y: auto; background: var(--c-panel); border-top: 1px solid var(--c-amber-lo); box-shadow: 0 -6px 14px rgba(0,0,0,.45); }
.ch-at-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 5px 12px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--c-line); border-radius: 0; }
.ch-at-row b { font-weight: 800; } .ch-at-row small { color: var(--c-muted); font-size: var(--fs-sm); }
.ch-at-row.all b { color: var(--c-amber-hi); }
.ch-at-all { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surf-amber); color: var(--c-amber-ink); font-weight: 900; }
.ch-emo { flex: none; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 172px; overflow-y: auto; padding: 6px 8px; background: var(--c-panel); border-top: 1px solid var(--c-line-hi); }
.ch-emo button { min-height: var(--tap-sm); padding: 0; border: 0; border-radius: var(--r-sm); background: none; box-shadow: none; font-size: 22px; line-height: 1; }
.ch-emo button:active { background: var(--c-panel-3); }

/* ---------- avatars: square, rounded corners, flag on the corner ---------- */
.ch-avb { position: relative; display: inline-grid; flex: none; vertical-align: middle; }
.ch-av, img.ch-av.pn-portrait, .ch-av.pn-portrait { flex: none; border-radius: 9px; }
img.ch-av, .ch-av.pn-portrait-fallback { border: 2px solid var(--c-amber-lo); background: var(--c-ink); object-position: top; box-shadow: var(--sh-1); }
.ch-ini { display: grid; place-items: center; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); background: radial-gradient(circle at 35% 30%, hsl(var(--h) 45% 46%), hsl(var(--h) 40% 22%) 75%); border: 2px solid hsl(var(--h) 45% 58% / .6); box-shadow: 0 2px 5px rgba(0,0,0,.4); }
.ch-flag { position: absolute; left: -5px; bottom: -4px; min-width: 18px; height: 14px; padding: 0 2px; display: grid; place-items: center; border-radius: 3px; background: #0b110d; border: 1px solid #fff6de; font: 800 9px/1 var(--font); font-style: normal; color: #fff; box-shadow: var(--sh-1); overflow: hidden; }
.ch-grp { position: relative; font-size: 22px; border-radius: 16px; }
.ch-grp b { position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; font-size: 10px; display: grid; place-items: center; background: var(--c-ink); border: 1px solid var(--pn-gold2); color: var(--pn-gold); text-shadow: none; }
.ch-av-wrap { position: relative; display: grid; place-items: center; }
.ch-dot { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; background: #5d6a61; border: 2.5px solid #18211b; }
.ch-dot.on { background: #4ee06a; box-shadow: 0 0 8px #4ee06a; }
.ch-dot.inline { position: static; width: 10px; height: 10px; border-width: 2px; flex: none; }

/* ---------- announcements ---------- */
.ch-pin { flex: none; }
.ch-ann { margin: 6px 10px 2px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--c-amber-lo); background: linear-gradient(var(--ch-paper), var(--ch-paper-2)); color: var(--ch-ink); box-shadow: var(--sh-2); cursor: pointer; }
.ch-ann .hd { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 3px 4px 3px 10px; background: var(--surf-amber); color: var(--c-amber-ink); border-bottom: 1px solid #9a6414; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.ch-ann .hd i { font-style: normal; font-size: 17px; }
.ch-ann .hd b { flex: 1; min-width: 0; font-weight: 800; font-size: var(--fs-base); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-ann .hd .x { flex: none; width: 30px; height: 28px; padding: 0; border-radius: var(--r-sm); background: rgba(0,0,0,.18); border: 1px solid rgba(0,0,0,.25); color: var(--c-amber-ink); font-weight: 900; box-shadow: none; position: relative; }
.ch-ann .hd .x::after { content: ''; position: absolute; inset: -6px -5px; }
.ch-ann .bd { padding: 8px 10px 6px; }
.ch-ann .tx { font-size: 14px; line-height: 1.38; white-space: pre-wrap; overflow-wrap: anywhere; }
.ch-ann.pinned .tx { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ch-ann .ch-trx { border-top-color: rgba(58,46,34,.3); color: #6b3d0c; }
.ch-ann .ft { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; margin-top: 6px; padding-top: 4px; border-top: 1px solid rgba(58,46,34,.18); }
.ch-ann .by { min-width: 0; font-size: 11.5px; color: #7a6a52; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-ann .by em { font-style: normal; font-weight: 800; color: #8a5a12; }
.ch-ann .acts { flex: none; margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ch-ann-cm { min-height: 32px; padding: 0 6px; border: 0; background: none; box-shadow: none; color: var(--ch-link); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.ch-ann-cm.flat { display: inline-flex; align-items: center; gap: 4px; color: #7a6a52; } .ch-ann-cm b { font-weight: 800; }
.ch-ann-like, .ch-ann-tr { min-height: 32px; min-width: 34px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border-radius: 16px; background: #fffaf0; border: 1px solid #c9b48a; color: #8a7a66; font: 800 12px/1 var(--font); box-shadow: none; }
.ch-ann-like i { display: grid; color: #b9a892; }
.ch-ann-like.on { border-color: #e58a80; color: #b12c22; background: #ffe9e4; } .ch-ann-like.on i { color: #e0453a; }
.ch-ann-tr.on { background: #ffe9b0; border-color: var(--c-amber-lo); color: #6b3d0c; }
.ch-ann-tr.busy { opacity: .55; animation: chPulse 1s ease-in-out infinite; }
.ch-ann-folded { display: flex; align-items: center; gap: 8px; width: calc(100% - 20px); min-height: 34px; margin: 6px 10px 2px; padding: 3px 10px; border-radius: var(--r-md); background: var(--surf-amber); color: var(--c-amber-ink); border: 1px solid #9a6414; text-align: left; box-shadow: var(--sh-1); }
.ch-ann-folded i { font-style: normal; } .ch-ann-folded b { flex: 1; min-width: 0; font-weight: 800; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-ann-list .ch-ann { margin: 0 0 10px; }
.ch-ann-list .ch-ann:not(.newest) .hd { background: var(--surf-wood); color: var(--c-amber-hi); text-shadow: 0 1px 0 #000; border-bottom-color: var(--c-amber-lo); }
#sheet .ch-ann { margin: 0 0 4px; cursor: default; }
.ch-ann-del { width: 100%; min-height: var(--tap-sm); margin: 6px 0 2px; font-size: var(--fs-md); color: #ffb3a8; background: rgba(0,0,0,.25); }
.ch-ann-title { margin-bottom: 8px; min-height: var(--tap); }
.ch-ann-text { min-height: 120px; resize: vertical; line-height: 1.4; }
.ch-ann-cnt { text-align: right; margin: 2px 2px 6px; }
/* comments */
.ch-cm-list { display: grid; gap: 8px; margin: 0 0 10px; }
.ch-cm { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: start; padding: 8px 9px; border-radius: var(--r-md); background: var(--surf-card); border: 1px solid var(--c-line); }
.ch-cm .mid { min-width: 0; }
.ch-cm .top { display: flex; align-items: baseline; gap: 8px; } .ch-cm .top b { font-weight: 800; font-size: var(--fs-md); color: var(--c-amber-pale); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-cm .top small { flex: none; color: var(--c-faint); font-size: var(--fs-xs); }
.ch-cm .tx { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; white-space: pre-wrap; }
.ch-cm-x { min-width: 32px; min-height: 32px; padding: 0 8px; border-radius: 16px; font-size: 12px; color: var(--c-muted); background: rgba(0,0,0,.25); box-shadow: none; }
.ch-cm-x.sure { color: #fff; background: var(--surf-blood); }
.ch-cm-none { text-align: center; color: var(--c-muted); font-size: var(--fs-md); padding: 14px 8px; border: 1px dashed var(--c-line-hi); border-radius: var(--r-md); }
.ch-cm-bar { position: sticky; bottom: -1px; display: flex; align-items: center; gap: 8px; padding: 8px 0 4px; background: linear-gradient(transparent, var(--c-panel) 10px); }

/* ---------- events ---------- */
.ch-ev { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; margin-bottom: 7px; border-radius: var(--r-lg); background: var(--surf-card); border: 1px solid var(--c-line); box-shadow: var(--sh-1); }
.ch-ev .ic { width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--c-ink); border: 1px solid var(--c-line-hi); font-size: 19px; box-shadow: var(--well); }
.ch-ev.k-rally .ic, .ch-ev.k-boss .ic { border-color: var(--c-blood-lo); } .ch-ev.k-capital .ic { border-color: var(--c-amber-lo); }
.ch-ev .mid { min-width: 0; } .ch-ev .tx { font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; } .ch-ev small { color: var(--c-faint); font-size: var(--fs-xs); }
.ch-ev .ch-coord { min-height: 32px; margin: 0; }

/* ---------- conversation lists ---------- */
.ch-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; }
.ch-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.ch-act { position: relative; flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; min-height: 56px; border-radius: 14px; font-weight: 800; color: var(--pn-gold); background: linear-gradient(135deg, #2c2614, var(--c-panel) 70%); border: 1px solid var(--pn-gold2); box-shadow: inset 0 1px 0 rgba(255,220,140,.15), 0 3px 8px rgba(0,0,0,.35); }
.ch-act .ic { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: rgba(0,0,0,.4); border: 1px solid #5a4422; }
.ch-act small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.ch-act .ch-pill { position: static; margin-left: auto; }
.ch-act.sm { flex: none; width: 56px; padding: 8px; justify-content: center; }
.ch-conv { display: grid; grid-template-columns: 50px 1fr auto; gap: 11px; align-items: center; padding: 10px 11px; margin-bottom: 8px; border-radius: 14px; background: linear-gradient(#1f2a23, #17201a); border: 1px solid #2f3f34; cursor: pointer; transition: transform .08s; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.ch-conv:active { transform: scale(.98); }
.ch-conv.unread { border-color: var(--pn-gold2); background: linear-gradient(90deg, #2a2410, var(--c-panel) 55%); box-shadow: inset 3px 0 0 var(--pn-gold), 0 2px 8px rgba(0,0,0,.35); }
.ch-conv .mid { min-width: 0; }
.ch-conv .nm { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-conv .last { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ch-conv.unread .last { color: var(--c-text); font-weight: 600; }
.ch-conv .last.none { font-style: italic; opacity: .7; }
.ch-conv .rt { display: grid; justify-items: end; gap: 5px; align-self: start; padding-top: 2px; }
.ch-conv .tm { font-size: 11px; color: var(--muted); }
.ch-conv.unread .tm { color: var(--pn-gold); font-weight: 700; }
.ch-conv .ch-pill { position: static; }

.ch-empty { display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--muted); padding: 34px 20px; font-size: 14px; }
.ch-empty .big { font-size: 46px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.ch-empty .spin { animation: chPulse 1s ease-in-out infinite alternate; }
.ch-empty button { min-height: 44px; padding: 8px 20px; }
@keyframes chPulse { 50% { opacity: .35; } }

/* ---------- sheets ---------- */
.ch-card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px; margin-bottom: 6px; border-radius: 14px; background: linear-gradient(135deg, #2a3a2e, #16211a); border: 1px solid var(--pn-gold2); }
.ch-card-nm { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.ch-card-nm .tag { color: var(--pn-gold); }
.ch-members { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0; }
.ch-mem { display: grid; justify-items: center; gap: 4px; font-size: 11px; text-align: center; min-width: 0; }
.ch-mem span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-plus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ch-plus-it { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 108px; padding: 12px 6px 10px; border-radius: var(--r-lg); text-align: center; }
.ch-plus-it .ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--c-ink); border: 1px solid var(--c-amber-lo); font-size: 23px; box-shadow: var(--well); }
.ch-plus-it b { font-weight: 800; font-size: var(--fs-md); color: var(--c-amber-hi); } .ch-plus-it small { font-size: var(--fs-xs); color: var(--c-muted); line-height: 1.25; }

/* ---------- friends ---------- */
.ch-search { display: flex; align-items: center; gap: 8px; background: var(--c-ink); border: 1px solid var(--pn-gold2); border-radius: 14px; padding: 0 12px; box-shadow: inset 0 2px 4px rgba(0,0,0,.5), 0 0 12px rgba(240,180,60,.08); }
.ch-search .ic { font-size: 16px; opacity: .8; }
.ch-search:focus-within { border-color: var(--pn-gold); }
.ch-box { background: linear-gradient(#1f2a22, #16201a); border: 1px solid #2f3f34; border-radius: var(--pn-r); padding: 2px 10px; }
.ch-box.req { border-color: var(--pn-gold2); background: linear-gradient(135deg, #2a2410, var(--c-panel) 60%); }
.ch-person { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid #2a382e; }
.ch-person:last-child { border-bottom: 0; }
.ch-person .mid { min-width: 0; }
.ch-person .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-person .nm .tag { color: var(--pn-gold); }
.ch-person .sub { font-size: 12px; color: var(--muted); }
.ch-person .sub .on { color: #4ee06a; font-weight: 700; }
.ch-person .acts { display: flex; gap: 6px; }
.ch-person .acts button { min-height: 38px; min-width: 40px; padding: 6px 10px; }
.ch-round { width: 40px; height: 40px; padding: 0 !important; border-radius: 50%; display: grid; place-items: center; font-size: 17px; }
.ch-round.gold { background: radial-gradient(circle at 40% 30%, #ffe9a8, #e39b27 70%); border-color: #ffe7a6; }
.ch-tagok { font-size: 12px; font-weight: 700; color: var(--good); }

/* ---------- new group ---------- */
.ch-hero { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; padding: 12px; border-radius: var(--pn-r); background: linear-gradient(135deg, #2b2a40, #16201a 70%); border: 1px solid var(--pn-gold2); }
.ch-hero .ic { font-size: 40px; text-align: center; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.ch-hero b { color: var(--pn-gold); font-size: 16px; }
.ch-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.ch-pick { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; min-width: 0; text-align: left; background: linear-gradient(#26342b, var(--c-panel)); border: 1px solid #3a4d40; transition: transform .08s; }
.ch-pick:active { transform: scale(.95); }
.ch-pick .nm { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-check { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-style: normal; font-weight: 900; background: var(--c-ink); border: 1.5px solid #5d6a61; color: transparent; }
.ch-pick.on { background: linear-gradient(#3a3214, #2a2410); border-color: var(--pn-gold); box-shadow: 0 0 10px rgba(240,180,60,.35); }
.ch-pick.on .ch-check { background: var(--good); border-color: #c9f5d1; color: var(--c-ink); }

/* chat is slightly see-through so the base or map stays faintly visible behind it */
#panel:has(.ch-screen) { background: transparent; }

/* photos */
.ch-bub.pic { padding: 4px 4px 6px; } .ch-bub.pic .ch-tx { display: block; padding: 2px 6px 0; }
.ch-pic { display: block; max-width: min(240px, 58vw); max-height: 300px; width: auto; height: auto; border-radius: 11px; margin-bottom: 2px; cursor: zoom-in; background: var(--c-ink); }
.ch-pic-gone { display: block; padding: 6px 8px; color: #7a6a52; font-size: 13px; }
.ch-view { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.92); display: grid; place-items: center; }
.ch-view img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.ch-view span { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #cfd8c8; font-size: 13px; opacity: .8; }

/* translation */
.ch-tr { flex: none; width: 30px; height: 28px; padding: 0; border-radius: 8px; display: grid; place-items: center; background: #1b2620; color: #9fb39a; border: 1px solid #36493c; }
.ch-tr.on { background: #2f4a3a; color: #ffe7a6; border-color: var(--pn-gold2); }
.ch-tr.busy { opacity: .55; animation: chPulse 1s ease-in-out infinite; }
.ch-trx { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(58,46,34,.4); color: #6b3d0c; }
.ch-trx.same { color: #7a6a52; font-style: italic; font-size: 13px; }
.ch-trx.hidden { display: none; }

/* moderation: long-press menu, report sheet */
.ch-quote { display: grid; gap: 2px; margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid var(--pn-gold2, #c8912a); border-radius: 6px; background: rgba(255,255,255,.05); font-size: 13.5px; overflow-wrap: anywhere; }
.ch-quote b { font-size: 12.5px; color: #ffe7a6; }
.ch-menu-list { display: grid; gap: 8px; } .ch-menu-list button { min-height: 46px; font-weight: 700; text-align: left; padding-left: 14px; }
.ch-reasons { display: grid; gap: 6px; margin-bottom: 10px; }
.ch-reason { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 6px 12px; text-align: left; font-weight: 700; border-radius: 12px; }
.ch-reason i { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #4a5a4e; display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 900; color: transparent; }
.ch-reason.on { border-color: var(--pn-gold2, #c8912a); background: rgba(240,180,60,.14); }
.ch-reason.on i { background: var(--pn-gold, #f0b43c); border-color: var(--pn-gold, #f0b43c); color: #241a05; }
.ch-report-note { width: 100%; min-height: 44px; padding: 8px 12px; margin-bottom: 8px; border-radius: 12px; border: 1px solid #36493c; background: rgba(0,0,0,.3); color: inherit; font: inherit; }

/* ---------- short and wide screens (phone landscape): every strip gets thinner so messages keep their room ---------- */
html.land .ch-ftabs { padding-top: 5px; } html.land .ch-ftab { min-height: 34px; } html.land .ch-ftab.on { min-height: 37px; margin-top: -3px; }
html.land .ch-subtabs { margin: 5px 10px 2px; padding: 3px; } html.land .ch-subtab { min-height: 30px; }
html.land .ch-bar { padding-top: 5px; padding-bottom: calc(5px + var(--safe-bottom)); }
/* a short screen keeps only the pinned card's title strip (tap it for the text, likes and comments) */
html.land .ch-ann.pinned .bd { display: none; } html.land .ch-ann.pinned .hd { min-height: 30px; border-bottom: 0; } html.land .ch-ann.pinned, html.land .ch-ann-folded { margin-top: 4px; }
@media (max-height: 560px) { .ch-ann.pinned .bd { display: none; } .ch-ann.pinned .hd { border-bottom: 0; } }
html.land .ch-emo { grid-template-columns: repeat(16, 1fr); max-height: 92px; }
html.land .ch-pickat { max-height: 96px; }
.ch-emb { display: inline-block; vertical-align: middle; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.ch-card-nm .ch-emb { margin-right: 6px; }
