/* Members-only Group Chat. Desktop defaults; mobile overrides below. */
#result>.ccc-group-chat-page{width:min(100%,760px);margin:0 auto;padding:0 0 24px;color:var(--text)}
.ccc-group-chat-page *{box-sizing:border-box}
.ccc-group-chat-page [hidden]{display:none!important}
.ccc-group-chat-toolbar,.ccc-group-chat-actions,.ccc-group-chat-message-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.ccc-group-chat-shell{display:grid;gap:12px;padding:clamp(12px,3vw,18px);background:var(--panel);border:1px solid var(--border);border-radius:var(--radius)}
.ccc-group-chat-toolbar{position:relative}
.ccc-group-chat-filter-wrap{position:relative;min-width:0}
.ccc-group-chat-filter-menu{position:absolute;top:calc(100% + 5px);left:0;z-index:15;min-width:175px;padding:5px;background:#1a1b22;border:1px solid var(--border);border-radius:10px;box-shadow:0 15px 35px #0008}
.ccc-group-chat-filter-menu button{display:block;width:100%;text-align:left;padding:9px 12px;border:0;background:transparent;color:var(--text);border-radius:7px;cursor:pointer}
.ccc-group-chat-filter-menu button[aria-pressed=true],.ccc-group-chat-filter-menu button:hover{background:rgba(154,139,255,.18)}
.ccc-group-chat-refresh{width:40px;min-width:40px;height:40px;padding:0;flex:0 0 auto}
.ccc-group-chat-refresh .material-symbols-outlined{font-size:21px;line-height:1}
.ccc-group-chat-status{font-size:12px;color:var(--muted)}.ccc-group-chat-status.is-error{color:#ff9eae}
.ccc-group-chat-stream{min-height:180px;max-height:min(52vh,520px);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain}
.ccc-group-chat-messages{display:grid;gap:10px}
.ccc-group-chat-message{position:relative;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:rgba(255,255,255,.035)}
.ccc-group-chat-message.is-mine{border-color:rgba(154,139,255,.35)}
.ccc-group-chat-message-head{justify-content:flex-start;flex-wrap:wrap;gap:5px 9px}
.ccc-group-chat-user{font-size:13px;overflow-wrap:anywhere}.ccc-group-chat-badge{font-size:11px;padding:3px 6px;background:rgba(154,139,255,.18);border-radius:5px}
.ccc-group-chat-time{color:var(--muted);font-size:11px;margin-left:auto}.ccc-group-chat-delete{font-size:11px}
.ccc-group-chat-delete-icon{display:none!important}
.ccc-group-chat-copy{margin:8px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;font-size:13px}
.ccc-group-chat-compose{display:grid;gap:9px;border-top:1px solid var(--border);padding-top:12px}
.ccc-group-chat-compose label{display:block;font-size:12px;margin-bottom:5px;color:var(--muted)}
.ccc-group-chat-compose textarea,.ccc-group-chat-compose select{width:100%;padding:10px;background:rgba(0,0,0,.19);color:var(--text);border:1px solid var(--border);border-radius:9px;font:inherit;font-size:14px}
.ccc-group-chat-compose textarea{min-height:80px;resize:vertical}
.ccc-group-chat-actions{align-items:end}.ccc-group-chat-category-field{flex:1;max-width:310px}.ccc-group-chat-send{min-width:100px;min-height:40px}
.ccc-group-chat-category-trigger{display:none!important}
.ccc-group-chat-send-icon{display:none!important}
.ccc-group-chat-page .auth-btn:disabled{opacity:.5;cursor:default}

/* Chat only: the site's shared slide-up picker, but with no unnecessary search
   box for the three/four fixed categories. Existing drag/Back behavior is reused. */
/* Preserve the shared picker geometry (top/height/bottom CSS vars) so the
   flag-up stays visible instead of taking its static position below the page. */
.ccc-mobile-picker-sheet.ccc-group-chat-picker{grid-template-rows:auto minmax(0,1fr);gap:12px}
.ccc-mobile-picker-sheet.ccc-group-chat-picker .ccc-mobile-picker-search-wrap{display:none!important}
.ccc-group-chat-picker-header{display:flex;align-items:center;gap:10px;padding:0 4px}
.ccc-group-chat-picker-header .ccc-mobile-picker-title{padding:0;min-width:0}
.ccc-group-chat-picker-back{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;background:transparent;color:var(--text);border:0;border-radius:9px;cursor:pointer}
.ccc-group-chat-picker-back .material-symbols-outlined{font-size:22px}
.ccc-mobile-picker-sheet.ccc-group-chat-picker .ccc-mobile-picker-options{gap:6px}
.ccc-mobile-picker-sheet.ccc-group-chat-picker .ccc-mobile-picker-option{min-height:46px;font-size:14px}

/* Mobile chat is its own visual-viewport screen. Never position it by
   subtracting the page's document top: keyboard opening changes that value. */
@media (max-width:780px),(hover:none) and (pointer:coarse){
  html.ccc-group-chat-active,body.ccc-group-chat-active{
    /* iOS Safari can strand the chat scroller after keyboard dismissal when
       both html and body are overflow-locked. The chat itself is fixed. */
    overscroll-behavior:none!important;
    overflow:hidden!important;
  }
  body.ccc-group-chat-active>.ccc-group-chat-page{
    position:fixed!important;
    left:var(--ccc-chat-visual-left,0px)!important;
    top:var(--ccc-chat-visual-top,0px)!important;
    right:auto!important;
    bottom:auto!important;
    width:var(--ccc-chat-visual-width,100vw)!important;
    max-width:none!important;
    height:var(--ccc-chat-visual-height,100dvh)!important;
    min-height:0;
    max-height:none;
    margin:0!important;
    padding:calc(9px + env(safe-area-inset-top,0px)) 8px 0;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    z-index:6000;
    background:#101114;
    isolation:isolate;
    overscroll-behavior:contain;
  }
  .ccc-group-chat-page>.ccc-tool-page-archive-heading{flex:0 0 auto;margin:0 0 5px}
  .ccc-group-chat-page>.ccc-tool-page-archive-heading h1{font-size:19px;line-height:1.15;margin:0}
  .ccc-group-chat-shell{
    flex:1 1 auto;min-height:0;min-width:0;display:flex;
    flex-direction:column;gap:7px;padding:9px 9px 0;
    border-radius:13px 13px 0 0;overflow:hidden;
  }
  .ccc-group-chat-toolbar{flex:0 0 auto;gap:7px}
  .ccc-group-chat-filter{min-height:36px;padding:6px 11px;font-size:12px;max-width:calc(100vw - 80px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .ccc-group-chat-refresh{width:36px;min-width:36px;height:36px;border-radius:10px}
  .ccc-group-chat-status{flex:0 0 auto;font-size:11px;max-height:44px;overflow-y:auto}
  .ccc-group-chat-stream{
    flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto;
    -webkit-overflow-scrolling:touch;scrollbar-width:thin;
    scroll-padding-bottom:8px;padding:0 1px 5px;
    touch-action:pan-y;overscroll-behavior:contain;
  }
  .ccc-group-chat-messages{gap:7px}
  .ccc-group-chat-message{padding:9px 11px 29px;border-radius:11px}
  .ccc-group-chat-message-head{gap:4px 7px;padding-right:24px}
  .ccc-group-chat-user{font-size:12px}.ccc-group-chat-badge{font-size:10px}
  .ccc-group-chat-time{position:absolute;right:10px;bottom:7px;font-size:10px;line-height:15px;margin:0;white-space:nowrap}
  .ccc-group-chat-copy{font-size:13px;margin-top:6px;line-height:1.45}
  .ccc-group-chat-delete{position:absolute;right:7px;top:5px;bottom:auto;width:27px;height:27px;min-width:27px;min-height:27px;display:flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:var(--muted);border-radius:50%}
  .ccc-group-chat-delete-label{display:none!important}
  .ccc-group-chat-delete-icon{display:inline-block!important;font-size:19px;line-height:1}
  .ccc-group-chat-delete:active{color:#ff9eae;background:rgba(255,130,150,.12)}
  .ccc-group-chat-compose{
    flex:0 0 auto;min-width:0;display:grid;
    grid-template-columns:44px minmax(0,1fr) 44px;
    align-items:end;gap:8px;margin:0 -9px;
    padding:8px 9px calc(8px + env(safe-area-inset-bottom,0px));
    background:var(--panel-2);border-top:1px solid var(--border);
    box-shadow:0 -4px 18px rgba(0,0,0,.08);
  }
  .ccc-group-chat-compose>label{display:none!important}
  .ccc-group-chat-actions{display:contents}
  .ccc-group-chat-compose textarea{
    grid-column:2;grid-row:1;min-width:0;display:block;
    min-height:44px;max-height:100px;height:44px;
    line-height:1.35;resize:none;font-size:16px;
    padding:10px 12px;border-radius:17px;
    overflow-y:auto;-webkit-overflow-scrolling:touch;
  }
  .ccc-group-chat-category-field{grid-column:1;grid-row:1;min-width:0;max-width:none}
  .ccc-group-chat-category-field>label,.ccc-group-chat-category-field>select{display:none!important}
  .ccc-group-chat-category-trigger{
    display:flex!important;align-items:center;justify-content:center;
    width:44px;min-width:44px;height:44px;min-height:44px;
    padding:0;border-radius:14px;font-size:12px;
    background:rgba(154,139,255,.16);
    border-color:rgba(154,139,255,.5);
  }
  .ccc-group-chat-category-trigger[data-category=on_the_hunt]{background:rgba(87,168,255,.13);border-color:rgba(87,168,255,.52);color:#8ac7ff}
  .ccc-group-chat-category-trigger[data-category=trade_sale]{background:rgba(255,146,68,.13);border-color:rgba(255,146,68,.52);color:#ffb17b}
  .ccc-group-chat-category-trigger>.material-symbols-outlined{font-size:23px;flex:0 0 auto}
  .ccc-group-chat-category-current,.ccc-group-chat-chevron{display:none!important}
  .ccc-group-chat-send{
    grid-column:3;grid-row:1;min-width:44px;width:44px;
    min-height:44px;height:44px;padding:0;
    display:flex;align-items:center;justify-content:center;
    border-radius:14px;
  }
  .ccc-group-chat-send-label{display:none!important}
  .ccc-group-chat-send-icon{display:inline-block!important;font-size:22px;line-height:1}
  .ccc-group-chat-page.ccc-group-chat-keyboard-open>.ccc-tool-page-archive-heading{display:none!important}
  .ccc-group-chat-page.ccc-group-chat-keyboard-open .ccc-group-chat-compose{
    padding-bottom:8px;
  }
}
@media (max-width:360px){
  .ccc-group-chat-shell{padding:7px 7px 0}
  .ccc-group-chat-compose{margin:0 -7px;padding:7px 7px calc(7px + env(safe-area-inset-bottom,0px))}
  .ccc-group-chat-page.ccc-group-chat-keyboard-open .ccc-group-chat-compose{padding-bottom:7px}
  .ccc-group-chat-time{font-size:9px}
}

/* Identical visual treatment and sizing for Home and Refresh controls. */
.ccc-group-chat-toolbar>.ccc-group-chat-home{display:inline-flex;align-items:center;justify-content:center}
.ccc-group-chat-toolbar>.ccc-group-chat-filter-wrap{flex:1 1 auto}
.ccc-group-chat-toolbar .ccc-group-chat-filter{max-width:100%;min-width:0}
@media (max-width:780px),(hover:none) and (pointer:coarse){
  .ccc-group-chat-toolbar>.ccc-group-chat-home{width:36px;min-width:36px;height:36px}
  .ccc-group-chat-toolbar .ccc-group-chat-filter{width:100%}
}
/* Tablets with touch-only input also need the existing flag-up visible, despite
   the main stylesheet's desktop (>780px) default of hiding mobile pickers. */
@media (min-width:781px) and (hover:none) and (pointer:coarse){
  body .ccc-mobile-picker-overlay.open{display:block!important}
  body .ccc-mobile-picker-sheet.ccc-group-chat-picker.open{display:grid!important}
}

/* Categories keep their familiar indicators: Chatter purple, On the Hunt
   blue, Trade/Sale orange. Their colors belong on the CATEGORY BADGES, not
   the whole message box. Each member gets a stable, muted non-category tone. */
.ccc-group-chat-message.category-chatter{--ccc-chat-category-rgb:154,139,255}
.ccc-group-chat-message.category-on-the-hunt{--ccc-chat-category-rgb:87,168,255}
.ccc-group-chat-message.category-trade-sale{--ccc-chat-category-rgb:255,146,68}
.ccc-group-chat-message:is(.category-chatter,.category-on-the-hunt,.category-trade-sale) .ccc-group-chat-badge{
  background:rgba(var(--ccc-chat-category-rgb),.30);
  border:1px solid rgba(var(--ccc-chat-category-rgb),.6);
  color:var(--text,#eef0f6);
}
/* Member-specific comic-pop OUTLINE colors: vivid lime, pink, red,
   mint, yellow and teal. Avoid purple, blue and orange used by the categories.
   The fill stays neutral for every member; identity is shown in the border. */
.ccc-group-chat-message.member-tone-0{--ccc-chat-member-rgb:184,255,77} /* neon lime */
.ccc-group-chat-message.member-tone-1{--ccc-chat-member-rgb:255,83,159} /* hot pink */
.ccc-group-chat-message.member-tone-2{--ccc-chat-member-rgb:51,245,193} /* electric mint */
.ccc-group-chat-message.member-tone-3{--ccc-chat-member-rgb:255,233,76} /* comic yellow */
.ccc-group-chat-message.member-tone-4{--ccc-chat-member-rgb:255,85,104} /* punch red */
.ccc-group-chat-message.member-tone-5{--ccc-chat-member-rgb:119,255,130} /* vivid green */
.ccc-group-chat-message.member-tone-6{--ccc-chat-member-rgb:255,117,207} /* pop pink */
.ccc-group-chat-message.member-tone-7{--ccc-chat-member-rgb:60,242,221} /* bright teal */
.ccc-group-chat-message.member-tone-8{--ccc-chat-member-rgb:226,255,95} /* acid yellow */
.ccc-group-chat-message.member-tone-9{--ccc-chat-member-rgb:255,70,86} /* cherry */
.ccc-group-chat-message.member-tone-10{--ccc-chat-member-rgb:85,231,155} /* emerald mint */
.ccc-group-chat-message.member-tone-11{--ccc-chat-member-rgb:255,87,179} /* neon rose */
.ccc-group-chat-message.has-member-tone{
  background:#1c1c23;
  border:1px solid rgba(var(--ccc-chat-member-rgb),.30);
  box-shadow:none;
}
@media (hover:hover) and (pointer:fine){
  .ccc-group-chat-message.has-member-tone:hover{
    border-color:rgba(var(--ccc-chat-member-rgb),.48);
  }
}

/* Long-press on chat chrome must not select/drag the whole page. Preserve
   text selection in message bubbles and normal scrolling in the message list. */
@media (max-width:780px),(hover:none) and (pointer:coarse){
  .ccc-group-chat-toolbar,.ccc-group-chat-message-head,.ccc-group-chat-actions{
    -webkit-user-select:none;user-select:none;
    -webkit-touch-callout:none;
  }
  .ccc-group-chat-copy,.ccc-group-chat-compose textarea{
    -webkit-user-select:text;user-select:text;
  }
}

/* Inline confirmation instead of browser confirm(), which can be suppressed
   by mobile/PWA browsers. The delete control must react to the first tap. */
.ccc-group-chat-delete-confirm{
  display:flex;align-items:center;justify-content:flex-end;gap:8px;
  margin:9px 0 15px;flex-wrap:wrap;
}
.ccc-group-chat-delete-confirm .auth-btn{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:34px;min-width:66px;padding:6px 12px;
  font-size:12px;line-height:1.2;border-radius:9px;
}
.ccc-group-chat-delete-confirm .ccc-group-chat-delete-approve{
  color:#ffc9d3;background:rgba(255,92,120,.12);
  border-color:rgba(255,92,120,.65);
}
.ccc-group-chat-delete-confirm .ccc-group-chat-delete-cancel{
  background:rgba(255,255,255,.045);
  border-color:rgba(255,255,255,.20);
}
.ccc-group-chat-delete[hidden]{display:none!important}
