/* Discord-inspired chat surface, aligned with RaceCentral's light/dark themes. */
/* RC05/RC09: show real audience and loading/recovery without changing the chat layout. */
.chat-conversation-head p.chat-series-context{white-space:normal;line-height:1.45;margin:0 0 4px}
.chat-series-context a{color:var(--discord-text);text-decoration:none}
.chat-series-context a:hover{text-decoration:underline}
.chat-conversation-head p.chat-audience{white-space:normal;overflow:visible;line-height:1.45;margin-top:4px}
.chat-composer-audience{margin:0;padding:6px 16px;color:var(--discord-muted);font-size:11px;line-height:1.45}
.chat-connection{display:flex;align-items:center;gap:12px;flex-shrink:0;flex-wrap:wrap}
.chat-connection[hidden],#community-chat-retry[hidden]{display:none}
#community-chat-retry{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:0 12px;border:1px solid #8ebaa0;border-radius:8px;background:#eef9f2;color:#176642;font-size:13px}
:root[data-theme=dark] #community-chat-retry{border-color:#477a5c;background:#1f4236;color:#bee4ca}
#community-chat-retry:focus-visible{outline:2px solid currentColor;outline-offset:3px}
@media(max-width:760px){#community-chat-retry{min-height:44px}.chat-composer-audience{padding-inline:12px}}
#chat-nav{margin:0 0 5px}
.chat-page-wrap{max-width:1180px!important;padding-top:0!important;padding-bottom:0!important}
.chat-app{--discord-bg:#313338;--discord-sidebar:#2b2d31;--discord-hover:#2e3035;--discord-active:#404249;--discord-text:#f2f3f5;--discord-message:#dbdee1;--discord-muted:#b5bac1;--discord-line:#1f2023;--discord-accent:#5865f2;--discord-input:#383a40;--discord-avatar:#232428;--discord-avatar-text:#c9cdfb;--discord-link:#00a8fc;--discord-source:#aeb6ff;--discord-shadow:#0008;--discord-scroll:#1a1b1e;display:grid;grid-template-columns:var(--chat-channel-width,240px) 7px minmax(0,1fr);height:calc(100dvh - var(--navigation-bottom,160px) - 5px);min-height:0;max-height:880px;border:1px solid var(--discord-line);border-radius:8px;background:var(--discord-bg);color:var(--discord-text);overflow:hidden;box-shadow:0 8px 30px var(--discord-shadow);font-family:"gg sans","Noto Sans","Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px}
:root:not([data-theme=dark]) .chat-app{--discord-bg:#fff;--discord-sidebar:#f2f3f5;--discord-hover:#eef0f3;--discord-active:#dfe1e5;--discord-text:#1e1f22;--discord-message:#313338;--discord-muted:#5c5e66;--discord-line:#d7d9de;--discord-input:#ebedef;--discord-avatar:#dfe3ea;--discord-avatar-text:#3f4b72;--discord-link:#006ce7;--discord-source:#4752c4;--discord-shadow:#17263f1f;--discord-scroll:#aeb3bd}

.chat-channel-sidebar{display:flex;min-width:0;min-height:0;flex-direction:column;overflow:hidden;background:var(--discord-sidebar)}
.chat-sidebar-resizer{position:relative;z-index:3;width:7px;min-width:7px;height:100%;padding:0;border:0;border-radius:0;background:var(--discord-line);cursor:col-resize;touch-action:none}.chat-sidebar-resizer::after{content:"";position:absolute;inset:0 2px;background:transparent;transition:background .15s}.chat-sidebar-resizer:hover::after,.chat-sidebar-resizer:focus-visible::after,.chat-app.is-resizing .chat-sidebar-resizer::after{background:var(--discord-accent)}.chat-sidebar-resizer:focus-visible{outline:2px solid var(--discord-accent);outline-offset:-2px}.chat-app.is-resizing,.chat-app.is-resizing *{cursor:col-resize!important;user-select:none}
.chat-category-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:56px;padding:10px 14px;border-bottom:1px solid var(--discord-line);box-sizing:border-box}
.chat-category-heading>div{min-width:0}.chat-category-heading span{display:block;color:var(--discord-muted);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em}.chat-category-heading strong{display:block;margin-top:2px;color:var(--discord-text);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-category-heading>a{display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;border-radius:4px;color:var(--discord-muted);text-decoration:none;font-size:15px}.chat-category-heading>a:hover{background:var(--discord-active);color:var(--discord-text)}
.chat-channel-list{display:grid;align-content:start;gap:2px;flex:1;min-height:0;padding:8px;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:var(--discord-scroll) var(--discord-sidebar)}.chat-channel-list a{display:flex;align-items:center;gap:7px;padding:7px 9px;border-radius:4px;color:var(--discord-muted);text-decoration:none;font-size:14px;font-weight:600}.chat-channel-list a>span:first-child{font-size:18px;font-weight:400;line-height:1}.chat-channel-list a:hover{background:var(--discord-hover);color:var(--discord-text)}.chat-channel-list a.active{background:var(--discord-active);color:var(--discord-text)}.chat-channel-list p{padding:8px;color:var(--discord-muted);font-size:12px}.channel-lock{margin-left:auto;font-size:11px}

.chat-conversation{display:flex;min-width:0;min-height:0;max-height:100%;flex-direction:column;overflow:hidden;background:var(--discord-bg)}
.chat-conversation-head{display:flex;align-items:center;gap:16px;min-height:56px;padding:8px 16px;border-bottom:1px solid var(--discord-line);box-sizing:border-box;box-shadow:0 1px 0 var(--discord-shadow)}.chat-conversation-head>div{min-width:0;margin-right:auto}.chat-conversation-head h2{margin:0;color:var(--discord-text);font-size:16px;line-height:1.2;letter-spacing:0}.chat-conversation-head h2 span{color:var(--discord-muted);font-size:20px;font-weight:400}.chat-conversation-head p{margin:2px 0 0;color:var(--discord-muted);font-size:11px;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.online-count{white-space:nowrap;color:var(--discord-muted);font-size:11px}.chat-muted-manage{border:0;background:transparent;color:var(--discord-muted);font:inherit;font-size:11px;font-weight:700;cursor:pointer;padding:5px}.chat-muted-manage:hover{color:var(--discord-text)}

.chat-message-list{flex:1;min-height:0;overflow-y:auto;padding:12px 0 18px;overscroll-behavior:contain;scrollbar-color:var(--discord-scroll) var(--discord-sidebar)}
.chat-message-list{padding:0}
.chat-message-items{padding:12px 0 18px}
.chat-message-list .chat-conversation-head{position:sticky;top:0;z-index:2;background:var(--discord-bg)}
.chat-empty-message{margin:0;padding:0 16px;color:var(--discord-muted);font-size:13px;line-height:1.4}
.chat-message{position:relative;display:grid;grid-template-columns:38px minmax(0,1fr);gap:9px;padding:3px 16px;outline:0}.chat-message:hover,.chat-message:focus{background:var(--discord-hover)}.chat-message-avatar{grid-row:1 / span 3;width:36px;height:36px;display:grid;place-items:center;border-radius:50%;background:var(--discord-avatar);color:var(--discord-avatar-text);font-size:13px;font-weight:800;object-fit:cover}.chat-message-main{min-width:0}.chat-message-author{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;line-height:1.15}.chat-rider-name,.chat-message-author strong{border:0;background:transparent;color:var(--discord-text);font:inherit;font-size:13px;font-weight:700;padding:0}.chat-rider-name{cursor:pointer}.chat-rider-name:hover{text-decoration:underline}.chat-source,.chat-edited,.chat-message-time{color:var(--discord-muted);font-size:10px}.chat-source.discord{color:var(--discord-source);font-weight:800}.chat-bot-mark{padding:1px 4px;border-radius:3px;background:var(--discord-accent);color:#fff;font-size:9px;font-weight:800}.chat-message-body{overflow-wrap:anywhere;white-space:pre-wrap;color:var(--discord-message);font-size:13px;line-height:1.35}.chat-message-body a{color:var(--discord-link)}.chat-message-media{display:flex;gap:8px;flex-wrap:wrap;margin-top:7px}.chat-message-media img,.chat-message-media video{display:block;max-width:min(520px,100%);max-height:360px;border-radius:8px;background:#000;object-fit:contain}.chat-message-media a{display:block;max-width:100%}
.chat-message-team{display:inline-block;max-width:min(175px,100%);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 5px;border:0;border-radius:3px;background:var(--team-background);color:var(--team-color);box-shadow:none;font-family:"ZwiftSprint-Medium",Helvetica,sans-serif;font-size:10px;font-weight:700;line-height:1.15;vertical-align:baseline}
.chat-message-actions{position:absolute;z-index:4;top:-16px;right:14px;display:flex;align-items:center;padding:2px;border:1px solid var(--discord-line);border-radius:6px;background:var(--discord-sidebar);box-shadow:0 4px 12px var(--discord-shadow);opacity:0;visibility:hidden;transform:translateY(3px);transition:opacity .12s,transform .12s,visibility .12s}.chat-message:hover>.chat-message-actions,.chat-message:focus>.chat-message-actions,.chat-message:focus-within>.chat-message-actions{opacity:1;visibility:visible;transform:translateY(0)}.chat-message-actions[hidden]{display:none}.chat-message-action{display:grid;place-items:center;width:30px;height:28px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--discord-muted);font:inherit;cursor:pointer}.chat-message-action:hover,.chat-message-action:focus-visible{background:var(--discord-active);color:var(--discord-text);outline:0}.chat-message-action svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.chat-message-action svg path:first-child:only-child{fill:currentColor;stroke:none}.chat-quick-reaction{font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-size:16px}.chat-action-delete:hover,.chat-action-delete:focus-visible{color:#f23f42}
.chat-reply-reference{display:block;max-width:100%;margin:0 0 2px;padding:0;border:0;background:transparent;color:var(--discord-muted);font:inherit;font-size:10px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.chat-reply-reference strong{color:var(--discord-text);font-size:inherit}.chat-reply-reference:hover{text-decoration:underline}.chat-reaction-list{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}.chat-reaction{padding:2px 7px;border:1px solid var(--discord-line);border-radius:8px;background:var(--discord-sidebar);color:var(--discord-message);font:inherit;font-size:12px;cursor:pointer}.chat-reaction:hover,.chat-reaction.active{border-color:var(--discord-accent);background:color-mix(in srgb,var(--discord-accent) 16%,var(--discord-sidebar))}.chat-reaction:disabled{cursor:default}.chat-inline-editor textarea{display:block;width:100%;min-height:38px;max-height:160px;box-sizing:border-box;padding:7px 9px;border:1px solid var(--discord-accent);border-radius:5px;background:var(--discord-input);color:var(--discord-text);font:inherit;font-size:13px;resize:vertical}.chat-inline-editor-actions{display:flex;gap:7px;margin-top:5px}.chat-inline-editor-actions button{padding:3px 8px;border:0;border-radius:4px;background:transparent;color:var(--discord-muted);font:inherit;font-size:11px;cursor:pointer}.chat-inline-editor-actions .chat-edit-save{background:var(--discord-accent);color:#fff}

.chat-composer{position:relative;flex-shrink:0;margin:0 16px 16px;border:0;background:transparent}.chat-replying{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 9px;border-radius:8px 8px 0 0;background:var(--discord-sidebar);color:var(--discord-muted);font-size:11px}.chat-replying[hidden]{display:none}.chat-replying strong{color:var(--discord-text)}.chat-replying button{border:0;background:transparent;color:var(--discord-muted);font:inherit;font-size:17px;line-height:1;cursor:pointer}.chat-replying:not([hidden])+.chat-input-shell{border-radius:0 0 8px 8px}.chat-input-shell{display:flex;align-items:flex-end;gap:3px;padding:5px 7px;border-radius:8px;background:var(--discord-input)}.chat-input-action{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;padding:0;border:0;border-radius:5px;background:transparent;color:var(--discord-muted);font:inherit;font-size:22px;line-height:1;cursor:pointer}.chat-input-action:hover{background:var(--discord-active);color:var(--discord-text)}.chat-input-action:disabled{opacity:.45;cursor:not-allowed}.chat-emoji-button{font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-size:23px}.chat-media-button svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}.chat-composer textarea{display:block;flex:1;width:100%;height:auto;min-height:34px;max-height:144px;padding:8px 7px;resize:none;box-sizing:border-box;border:0;border-radius:4px;background:transparent;color:var(--discord-text);font-size:13px;line-height:18px}.chat-composer textarea::placeholder{color:var(--discord-muted)}.chat-composer textarea:focus{outline:none}.chat-composer input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.chat-composer .emoji-picker{position:absolute;z-index:20;right:0;bottom:calc(100% + 8px);display:flex;flex-wrap:wrap;gap:3px;width:min(320px,calc(100vw - 32px));padding:8px;border:1px solid var(--discord-line);border-radius:8px;background:var(--discord-sidebar);box-shadow:0 12px 30px var(--discord-shadow);box-sizing:border-box}.chat-composer .emoji-picker[hidden]{display:none}.chat-composer .emoji-picker button{display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:4px;background:transparent;font-size:18px;cursor:pointer}.chat-composer .emoji-picker button:hover{background:var(--discord-active)}.chat-upload-state{display:flex;align-items:center;gap:8px;padding:0 8px}.chat-upload-state:has(.chat-attachment-name:empty) .chat-attachment-name{display:none}.chat-attachment-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--discord-muted);font-size:11px}.chat-attachment-clear{border:0;background:transparent;color:#f23f42;font:inherit;font-size:11px;cursor:pointer}.chat-composer.is-sending{opacity:.7}
.chat-feedback,.chat-connection,.chat-signin{margin:0;padding:6px 16px;color:var(--discord-muted);font-size:11px}.chat-signin a{color:#00a8fc!important}.chat-feedback:empty{display:none}.chat-connection[hidden]{display:none}.chat-empty-channel{margin:auto;text-align:center;padding:32px;color:var(--discord-muted)}.chat-empty-channel h2{margin-bottom:6px;color:var(--discord-text);font-size:18px}

#chat-rider-dialog{max-width:520px;width:calc(100% - 40px);box-sizing:border-box;max-height:85vh;overflow:auto}#chat-rider-close{float:right;font-size:22px}.chat-rider-photo{width:80px;height:80px;object-fit:cover;border-radius:50%;margin-top:16px}#chat-rider-content dl{display:grid;grid-template-columns:1fr 1.5fr;gap:10px;font-size:14px}#chat-rider-content dt{color:var(--muted)}#chat-rider-content dd{margin:0;overflow-wrap:anywhere}.chat-mute-action{display:block;margin-top:18px}

@media(max-width:760px){#chat-nav{margin:0 0 5px}.chat-page-wrap{padding-inline:0!important}.chat-app{grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);height:calc(100dvh - var(--navigation-bottom,170px) - 5px);min-height:0;max-height:none;border-radius:0;border-inline:0}.chat-sidebar-resizer{display:none}.chat-channel-sidebar{border-right:0;border-bottom:1px solid var(--discord-line)}.chat-category-heading{min-height:44px;padding:7px 12px}.chat-channel-list{display:flex;flex:none;overflow-x:auto;overflow-y:hidden;padding:6px 8px}.chat-channel-list a{flex:0 0 auto}.chat-conversation-head{min-height:48px;padding:7px 12px}.chat-message{padding-inline:12px}.chat-empty-message{padding-inline:12px}.online-count{display:none}.chat-composer{margin:0 10px 10px}}
@media(max-width:760px){.chat-message-list .chat-conversation-head{position:static}}
@media(max-width:760px){.chat-category-heading{display:none}}
@media(max-width:760px){
  .chat-app{grid-template-rows:54px minmax(0,1fr)}
  .chat-channel-sidebar{height:54px;min-height:54px}
  .chat-channel-list{height:100%;box-sizing:border-box;align-items:center}
}
@media(max-width:760px){
  .chat-input-shell{align-items:center;flex-wrap:nowrap;min-height:44px;box-sizing:border-box;padding:4px 7px}
  .chat-input-shell .chat-input-action{flex:0 0 34px;align-self:center}
  .chat-input-shell textarea{flex:1 1 0;min-width:0;width:auto;margin:0;min-height:34px}
}

/* Keep displayed, drafted, and edited message text at the same reading size. */
.chat-message-body,.chat-reply-reference,.chat-message-author .chat-rider-name,.chat-message-author strong,.chat-composer textarea,.chat-inline-editor textarea{font-size:calc(14px + 1pt)}
.chat-add-button{font-size:29px;font-weight:400}.chat-add-menu{position:absolute;z-index:21;left:0;bottom:calc(100% + 8px);min-width:180px;padding:6px;border:1px solid var(--discord-line);border-radius:8px;background:var(--discord-sidebar);box-shadow:0 12px 30px var(--discord-shadow)}.chat-add-menu[hidden]{display:none}.chat-add-menu button{display:block;width:100%;padding:10px 12px;border:0;border-radius:5px;background:transparent;color:var(--discord-text);font:inherit;text-align:left;cursor:pointer}.chat-add-menu button:hover,.chat-add-menu button:focus-visible{background:var(--discord-active)}
.chat-composer textarea{line-height:calc(18px + 1pt)}

/* Unread count per channel: a white number in a red circle, as Discord
   does it. Hidden rather than zero-width when there is nothing to say. */
.chat-channel-list a{position:relative}
.chat-unread-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;margin-left:auto;padding:0 5px;border-radius:999px;background:#f23f43;color:#fff;font-size:.68rem;font-weight:700;line-height:1;font-variant-numeric:tabular-nums}
.chat-unread-badge[hidden]{display:none}

/* A pasted image or GIF link renders as the picture. Bounded so a tall
   image cannot push the rest of the conversation off the screen. */
.chat-message-linked-media img{max-width:min(320px,100%);max-height:240px;border-radius:10px;object-fit:contain}
.chat-message-continuation .chat-message-main{grid-column:2}
.chat-message-continuation{padding-top:0;padding-bottom:0}
.chat-message-avatar{grid-row:1}
.chat-message{row-gap:0}
.chat-message:has(+ .chat-message-continuation){padding-bottom:0}
.chat-message:not(:has(+ .chat-message-continuation)){padding-bottom:1px}
.chat-conversation-head h2{font-size:20px}

/* One chat-only type scale: Discord-like proportions, no proprietary fonts.
   The same stack applies to message text, controls and the channel sidebar. */
.chat-app{--chat-font:"Helvetica Neue",Helvetica,Arial,sans-serif;--chat-body-size:16px;--chat-avatar-size:40px;font-family:var(--chat-font);font-size:var(--chat-body-size)}
:root .chat-app{--discord-accent:#16804a;--discord-source:#176c46;--discord-avatar-text:#176c46}
:root[data-theme=dark] .chat-app{--discord-accent:#269d65;--discord-source:#8ed5b1;--discord-avatar-text:#8ed5b1}
.chat-app h2,.chat-app h3,.chat-app button,.chat-app input,.chat-app textarea,.chat-app select{font-family:var(--chat-font)}
.chat-message{grid-template-columns:var(--chat-avatar-size) minmax(0,1fr);column-gap:16px;padding-top:8px}
.chat-message-avatar{width:var(--chat-avatar-size);height:var(--chat-avatar-size);font-size:16px;font-weight:600}
.chat-message-author{gap:8px;line-height:22px}
.chat-message-body,.chat-message-author .chat-rider-name,.chat-message-author strong,.chat-composer textarea,.chat-inline-editor textarea{font-size:var(--chat-body-size);line-height:22px}
.chat-message-author .chat-rider-name,.chat-message-author strong{font-weight:600}
.chat-app .chat-rider-name{color:var(--discord-text)}
.chat-source,.chat-edited,.chat-message-time{font-size:12px;line-height:18px}
.chat-reply-reference{font-size:13px;line-height:18px}
.chat-message-team{font-family:var(--chat-font);font-size:12px;line-height:16px}
.chat-message-continuation{padding-top:0}
.chat-conversation-head h2{font-family:var(--chat-font);font-size:16px;font-weight:600;line-height:24px}
.chat-composer textarea{padding-block:8px}
.chat-app :is(a,button,summary,textarea):focus-visible{outline:2px solid var(--discord-accent);outline-offset:2px}
