/* Community appearance. Semantic overrides preserve photos, videos and card artwork. */
:root {color-scheme:light;--theme-bg:#fff;--theme-panel:#fff;--theme-raised:#f6f6f7;--theme-text:#262626;--theme-muted:#6b6b73;--theme-border:#e5e5e8;--theme-accent:#dc2445;--theme-tint:#fff0f3}
:root[data-theme=dark] {color-scheme:dark;--theme-bg:#101114;--theme-panel:#191b20;--theme-raised:#252830;--theme-control:#2b2e37;--theme-hover:#323640;--theme-text:#f2f3f6;--theme-muted:#aeb3bf;--theme-border:#343842;--theme-accent:#ff708a;--theme-accent-strong:#e33657;--theme-tint:#3d222c;--theme-danger:#ff8c9f;
  --paper:var(--theme-panel);--ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-border);
  --feed-bg:var(--theme-bg);--feed-soft:var(--theme-raised);--feed-line:var(--theme-border);--feed-text:var(--theme-text);--feed-muted:var(--theme-muted);
  --account-text:var(--theme-text);--account-muted:var(--theme-muted);--account-line:var(--theme-border);--account-soft:var(--theme-raised);
  --community-text:var(--theme-text);--community-muted:var(--theme-muted);--community-line:var(--theme-border);--community-soft:var(--theme-raised);
  --primary-text:var(--theme-text);--primary-line:var(--theme-border);--xhs-text:var(--theme-text);--xhs-muted:var(--theme-muted);--xhs-line:var(--theme-border);--xhs-soft:var(--theme-raised);
  --profile-text:var(--theme-text);--profile-muted:var(--theme-muted);--profile-line:var(--theme-border);--publish-ink:var(--theme-text);--publish-muted:var(--theme-muted);--publish-line:var(--theme-border);--publish-soft:var(--theme-raised);
  --auth-text:var(--theme-text);--auth-muted:var(--theme-muted);--auth-line:var(--theme-border);--card-ink:var(--theme-text);--card-muted:var(--theme-muted);--card-line:var(--theme-border)
}
.theme-picker {position:relative;flex:0 0 auto;color:var(--theme-text);font:14px/1.5 "PingFang SC","Microsoft YaHei",Arial,sans-serif;letter-spacing:normal}
.theme-picker summary {box-sizing:border-box;width:34px;height:34px;padding:0;display:grid;place-items:center;list-style:none;cursor:pointer;border:1px solid var(--theme-border);border-radius:50%;background:var(--theme-panel);color:var(--theme-muted)}
.theme-picker summary::-webkit-details-marker {display:none}
.theme-picker summary:hover,.theme-picker[open] summary {background:var(--theme-raised)!important;color:var(--theme-text)!important}
.theme-picker :focus-visible {outline:2px solid var(--theme-accent)!important;outline-offset:3px}
.theme-picker fieldset {box-sizing:border-box;position:absolute;z-index:100;top:44px;right:0;width:204px;margin:0;padding:16px;border:1px solid var(--theme-border);border-radius:16px;background:var(--theme-panel);color:var(--theme-text);box-shadow:0 12px 36px #0003}
.theme-picker legend {float:left;width:100%;padding:0;margin:0 0 10px;font-size:13px;font-weight:700;color:var(--theme-text)}
.theme-picker label {clear:both;display:flex;align-items:center;gap:10px;min-height:40px;margin:0;padding:0 8px;border-radius:8px;cursor:pointer;font-size:14px;color:var(--theme-text)}
.theme-picker label:hover {background:var(--theme-raised)}
.theme-picker input {appearance:auto;width:16px;height:16px;flex:0 0 16px;margin:0;padding:0;accent-color:var(--theme-accent)}
.theme-picker p {margin:12px 0 0;font-size:11px;line-height:1.5;color:var(--theme-muted);white-space:normal}
.theme-picker-corner {position:fixed;z-index:60;right:16px;bottom:20px}
.theme-picker-corner fieldset {top:auto;bottom:44px}
@media(max-width:800px) {
  .feed-header,.community-global-topbar {gap:6px!important}
  .feed-header .feed-header-actions {gap:6px!important}
  .feed-header .feed-brand {gap:6px!important}
  .theme-picker-corner {bottom:calc(76px + env(safe-area-inset-bottom))}
  .auth-page .theme-picker-corner {bottom:calc(16px + env(safe-area-inset-bottom))}
  body.chat-keyboard-open .theme-picker,body.publish-keyboard-open .theme-picker {display:none}
}
/* Keep native details and all page-level hidden states authoritative. */
.theme-picker:not([open])>fieldset {display:none}
html[data-theme=dark],html[data-theme=dark] body {background:var(--theme-bg)!important;color:var(--theme-text)!important}
html[data-theme=dark] :is(.feed-header,.community-global-topbar,.feed-sidebar,.mobile-dock,.account-sidebar,.chat-topbar,.chat-sidebar,.chat-room-head,.composer,.connections-topbar,.user-site-header,.publish-topbar,.card-top,.post-view-header,.feed-tabs,.admin-global-search) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.social-shell,.social-list,.feed-main,.account-main,.account-shell,.user-page-shell,.chat-shell,.chat-main,.message-list,.matches-shell,.space-shell,.publish-shell,.post-view-main,.card-view-shell) {background:var(--theme-bg)!important;color:var(--theme-text)!important}
html[data-theme=dark] :is(.social-panel,.post-card,.teacher-card,.teacher-profile-card,.teacher-facts article,.teacher-comment-layout form,.account-summary article,.account-shortcuts a,.account-content-panel,.account-name-card,.account-alert,.content-overview,.matches-hero,.match-card,.space-hero,.room-card,.echo-card,.notice-card,.notice-actions,.auth-card,.admin-security-card,.admin-user-card,.summary-card,.range-card,.panel,.card-controls,.card-preview-panel,.publish-studio,.post-detail-card,.post-comments,.user-profile-compact,.user-relationship-block,.history-result,.member-option,.connection-row,.conversation-row) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important;box-shadow:none}
html[data-theme=dark] :is(.sidebar-note,.feed-search,.media-workspace,.media-dropzone,.image-preview,.video-link-panel,.publish-tips,.action-item,.text-cover,.post-gallery-empty,.chat-muted,.user-empty,.match-empty,.message-quote,.quote-compose,.conversation:hover,.conversation.is-active,.admin-user-search,.auth-email-row,.history-searchbar,.history-tabs) {background:var(--theme-raised)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(h1,h2,h3,h4,label,legend,th,td,.post-caption,.post-full-caption,.user-name-row,.notice-copy b,.account-shortcuts b,.feed-brand,.connection-row b,.conversation-copy b,.message-meta a,.chat-peer,.group-heading) {color:var(--theme-text)!important}
html[data-theme=dark] :is(p,small,.eyebrow,.auth-intro,.auth-back,.auth-switch,.post-author,.post-author b,.user-bio,.user-stats,.user-note-author,.notice-copy p,.notice-copy small,.feed-footer,.message-time-separator,.message-read-state,.chat-status,.history-result-copy,.history-result-copy small,.connection-row small,.conversation-copy small,.teacher-breadcrumb,.project-root-link,.account-nav a,.feed-sidebar nav a,.mobile-dock a) {color:var(--theme-muted)!important}
html[data-theme=dark] :is(input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=color]),textarea,select) {background:var(--theme-raised)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(input,textarea)::placeholder {color:#9399a8!important;opacity:1}
html[data-theme=dark] :is(.feed-search input) {background:transparent!important}
html[data-theme=dark] :is(button,.secondary-button,.user-message,.user-follow,.login-link,.post-actions a,.feed-toolbar a,.auth-code-row button,.admin-users-actions a) {border-color:var(--theme-border)!important;background:var(--theme-raised)!important;color:var(--theme-text)!important}
html[data-theme=dark] :is(.is-active,.account-nav a.is-active,.feed-sidebar nav a.is-active,.mobile-dock a.is-active,.space-tabs button.is-active,.feed-toolbar .is-active,.notice-entry,.post-like,.user-card-gift,.auth-switch a,.auth-forgot,.community-search-summary a) {color:var(--theme-accent)!important}
html[data-theme=dark] :is(.feed-sidebar nav a.is-active,.account-nav a.is-active,.space-tabs button.is-active,.notice-card.is-unread,.announcement-list article,.matches-tabs .is-active) {background:var(--theme-tint)!important}
html[data-theme=dark] :is(.publish-link,.send,.auth-card form>button,.space-compose>button,.publish-actions button:not(.draft-button),.admin-security-card button,.admin-user-card button,.trend-bar) {background:var(--theme-accent-strong)!important;color:#fff!important;border-color:var(--theme-accent-strong)!important}
html[data-theme=dark] :is(.message-bubble) {background:var(--theme-raised)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] .mine .message-bubble {background:#48313b!important;color:#fff0f4!important}
html[data-theme=dark] .message-highlight .message-bubble {outline:2px solid var(--theme-accent);outline-offset:3px}
html[data-theme=dark] :is(dialog,.space-dialog,.history-dialog-shell,.message-action-panel,.emoji-picker,.mention-suggestions,.admin-global-results,.clipboard-image-preview,.quote-compose,.batch-toolbar) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] dialog::backdrop {background:#0009}
html[data-theme=dark] :is(.avatar,.account-avatar,.account-card-avatar,.user-profile-avatar,.teacher-placeholder,.notice-avatar,.global-profile-avatar) {background:var(--theme-raised)!important;color:var(--theme-accent)!important}
/* Cards retain their chosen stationery colours in both themes. */
html[data-theme=dark] .xinyu-card {color:#3c2630!important}
html[data-theme=dark] .xinyu-card :is(h2,p,span) {color:inherit!important}
html[data-theme=dark] .theme-picker :is(label,legend) {color:var(--theme-text)!important}

html[data-theme=dark] :is(.account-card-edit,.account-nav #logout,.matches-view-tabs,.match-person,.matches-empty,.api-create-panel,.api-list-panel,.token-card,.teacher-profile,.auth-email-row,.history-tabs button,.history-close,.dialog-head,.space-compose,.space-compose label,.preview-add,.media-dropzone>span) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.matches-view-tabs button.is-active,.match-tag,.shared-tags a,.user-profile-action a,.teacher-verified,.account-card-name>span) {background:var(--theme-tint)!important;color:var(--theme-accent)!important}
html[data-theme=dark] :is(.privacy-note,.avatar-control,.avatar-current,.card-steps li,.card-memory,.card-preview-label,.teacher-profile-photo,.compact-comment-form,.api-warning,.api-doc-links,.letter-tabs,.letter-search) {background:var(--theme-raised)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] .connections-shell {background:var(--theme-bg)!important}
html[data-theme=dark] .card-steps li.is-active {background:var(--theme-tint)!important;color:var(--theme-accent)!important}
html[data-theme=dark] :is(.graph-panel,.letter-item,.token-result,.message-item,.comment-item,.echo-reply,.echo-thread,.echo-detail-head,.echo-detail-body,.group-member-row,.direct-user,.direct-user-card) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.user-note-text-cover,.user-meta-line span,.user-card-facts span,.user-card-orgs a,.user-relationship-block a,.post-placeholder,.space-feed-placeholder,.tag-space-hero,.comment-reply,.room-mark,.echo-alias,.member-avatar,.profile-tags b,.direction-tags b,.profile-tags em,.direction-tags em,.member-chip) {background:var(--theme-raised)!important;color:var(--theme-muted)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.user-verified,.user-card-tags a,.teacher-section-head span) {background:var(--theme-tint)!important;color:var(--theme-accent)!important}
html[data-theme=dark] #echo-detail {background:var(--theme-bg)!important;color:var(--theme-text)!important}
html[data-theme=dark] :is(.room-card h3,.echo-card b,.letter-copy b,.match-person b,.token-row b,.graph-panel b) {color:var(--theme-text)!important}
html[data-theme=dark] :is(.aegpc-emoji-panel,.mention-menu,.aegpc-drawing-overlay,.aegpc-drawing-head,.aegpc-drawing-tools,.aegpc-drawing-tools label,.aegpc-drawing-zoom) {background:var(--theme-panel)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] .aegpc-drawing-stage {background:var(--theme-bg)!important}
html[data-theme=dark] :is(input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=color]),textarea,select) {-webkit-text-fill-color:var(--theme-text)!important;caret-color:var(--theme-text)}
html[data-theme=dark] :is(input,textarea)::placeholder {-webkit-text-fill-color:#9399a8!important}
@media(max-width:800px) {.theme-picker-corner {bottom:calc(16px + env(safe-area-inset-bottom))}}

/* Dark appearance polish: restore control hierarchy after the shared surface reset. */
html[data-theme=dark] :is(.publish-actions,.message-batch-bar,.auth-switch,.history-head,.dialog-head) {background:color-mix(in srgb,var(--theme-panel) 94%,transparent)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(hr,.auth-switch,.history-head,.message-action-menu button+button,.comment-replies) {border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.feed-search,.letter-search,.history-searchbar) {box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--theme-border) 75%,transparent)}
html[data-theme=dark] :is(input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=color]),textarea,select):focus {border-color:var(--theme-accent)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--theme-accent) 18%,transparent)!important;outline:0}

html[data-theme=dark] :is(
  .publish-link,.send,.primary-button,.primary-action,.new-post-button,.user-follow,
  .auth-card form>button,.account-content-panel form>button,
  .account-content-panel form button:not([type=button]),
  .space-compose>button:not(.echo-role-chip),.room-action:not(.secondary),
  .directory-hero button,.space-hero button,.matches-hero button,.matches-search button,
  .history-searchbar button,.compact-comment-form button,.card-generate,
  .api-create-panel form>button,.token-result button:not(.secondary-button),
  .api-doc-links>button,.token-reveal-dialog button[type=submit],#reveal-copy,
  .range-card button.is-active,.range-card #apply-range,.post-inline-editor button[type=submit]
) {background:var(--theme-accent-strong)!important;color:#fff!important;border-color:var(--theme-accent-strong)!important;box-shadow:none!important}
html[data-theme=dark] :is(
  .publish-link,.send,.primary-button,.primary-action,.new-post-button,.user-follow,
  .auth-card form>button,.account-content-panel form>button,
  .space-compose>button:not(.echo-role-chip),.room-action:not(.secondary),
  .directory-hero button,.space-hero button,.matches-hero button,.matches-search button,
  .history-searchbar button,.compact-comment-form button,.card-generate,
  .api-create-panel form>button,.token-result button:not(.secondary-button),.api-doc-links>button
):not(:disabled):hover {background:#ef4263!important;border-color:#ef4263!important}

html[data-theme=dark] :is(
  .secondary-button,.draft-button,.user-message,.login-link,.room-action.secondary,
  .matches-pagination button,.direct-pagination button,.post-pagination button,
  .managed-actions button,.managed-actions a,.managed-editor button,
  .post-owner-actions a,.post-owner-actions button,.post-inline-editor button,
  .token-actions button,.token-row>button,.account-sidebar>button,
  .message-action-panel button,.message-batch-bar button,.new-chat-options>button
) {background:var(--theme-control)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(
  .secondary-button,.draft-button,.user-message,.room-action.secondary,
  .matches-pagination button,.direct-pagination button,.post-pagination button,
  .managed-actions button,.managed-actions a,.post-owner-actions a,.post-owner-actions button,
  .token-actions button,.token-row>button,.account-sidebar>button,.new-chat-options>button
):not(:disabled):hover {background:var(--theme-hover)!important;border-color:#4b505c!important}

html[data-theme=dark] :is(
  .dialog-head button,.history-close,.message-actions-button,.quote-compose button,
  .message-action-menu button,.matches-heading button,.comment-owner-actions button,
  .comment-reply-button,.reply-expand,.api-list-panel>div:first-child button,
  #media-lightbox button,.lightbox-close,.lightbox-arrow,.preview-tools button
) {background:transparent!important;border-color:transparent!important;box-shadow:none!important}
html[data-theme=dark] :is(.history-close,.message-actions-button,.quote-compose button,.matches-heading button,.comment-owner-actions button) {color:var(--theme-muted)!important}
html[data-theme=dark] :is(.history-close,.message-actions-button,.quote-compose button,.matches-heading button,.comment-owner-actions button):hover {color:var(--theme-text)!important}

html[data-theme=dark] :is(.space-tabs,.matches-view-tabs,.history-tabs,.letter-tabs,.feed-tabs) {background:var(--theme-raised)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.space-tabs button,.matches-view-tabs button,.history-tabs button,.letter-tabs button,.media-tabs button) {background:transparent!important;color:var(--theme-muted)!important;border-color:transparent!important}
html[data-theme=dark] :is(.space-tabs button.is-active,.matches-view-tabs button.is-active,.history-tabs button.is-active,.letter-tabs button.is-active) {background:var(--theme-tint)!important;color:var(--theme-accent)!important;border-color:transparent!important}
html[data-theme=dark] .media-tabs button.is-active {background:transparent!important;color:var(--theme-accent)!important}

html[data-theme=dark] :is(.notice-actions button,.chat-sidebar-head .chat-sidebar-actions #new-chat,.group-member-row>button,.user-card-gift,.auth-code-row button) {background:var(--theme-tint)!important;color:var(--theme-accent)!important;border-color:color-mix(in srgb,var(--theme-accent) 32%,var(--theme-border))!important}
html[data-theme=dark] :is(.chat-sidebar-head .chat-sidebar-actions button,.feed-toolbar button,.feed-toolbar a,.post-actions button,.post-actions a) {background:var(--theme-control)!important;color:var(--theme-text)!important;border-color:var(--theme-border)!important}
html[data-theme=dark] .chat-sidebar-head .chat-sidebar-actions #new-chat {background:var(--theme-tint)!important;color:var(--theme-accent)!important}
html[data-theme=dark] :is(.delete-button,.delete-post) {background:transparent!important;color:var(--theme-danger)!important;border-color:color-mix(in srgb,var(--theme-danger) 40%,var(--theme-border))!important}

html[data-theme=dark] button:disabled,
html[data-theme=dark] :is(.publish-link,.primary-button,.primary-action,.user-follow,.card-generate,.card-send):disabled {background:#21242a!important;color:#777d89!important;border-color:#2c3038!important;opacity:1!important;box-shadow:none!important}
html[data-theme=dark] :is(.card-send):not(:disabled) {background:var(--theme-accent-strong)!important;color:#fff!important;border-color:var(--theme-accent-strong)!important}

html[data-theme=dark] :is(.api-warning,.card-memory,.privacy-note,.publish-tips,.chat-muted,.action-item) {background:#24272e!important;border-color:var(--theme-border)!important}
html[data-theme=dark] .api-warning b {color:var(--theme-accent)!important}
html[data-theme=dark] .api-warning :is(h2,p,span) {color:var(--theme-muted)!important}
html[data-theme=dark] :is(.user-note-text-cover,.text-cover) {background:linear-gradient(145deg,#30232a,#222831)!important;color:var(--theme-text)!important}
html[data-theme=dark] :is(.letter-cover) {background:linear-gradient(145deg,#30232a,#20252c)!important}
html[data-theme=dark] :is(.letter-cover[data-style=quiet]) {background:linear-gradient(145deg,#222b34,#1c2026)!important}
html[data-theme=dark] :is(.letter-cover[data-style=bright]) {background:linear-gradient(145deg,#383020,#24221d)!important}
html[data-theme=dark] :is(.letter-paper-mark) {background:#ffffff14!important;color:var(--theme-accent)!important;box-shadow:none!important}
html[data-theme=dark] :is(.post-gallery-stage,.post-gallery-track,.post-gallery-slide,.lightbox-image-wrap) {background:#090a0c!important}
html[data-theme=dark] :is(.social-list,.community-page-heading,.connections-tabs,.connection-row,.teacher-section-head,.content-overview,.managed-editor,.managed-media-editor,.matches-section,.token-row) {border-color:var(--theme-border)!important}
html[data-theme=dark] :is(.connections-topbar>a,.connections-tabs a) {color:var(--theme-muted)!important}
html[data-theme=dark] .connections-tabs a.is-active {color:var(--theme-accent)!important;border-color:var(--theme-accent-strong)!important}
html[data-theme=dark] :is(.teacher-comment-layout form button,.reply-form-actions button[type=submit],.managed-editor .save-post) {background:var(--theme-accent-strong)!important;color:#fff!important;border-color:var(--theme-accent-strong)!important}
html[data-theme=dark] :is(
  .publish-actions button,.api-create-panel form>button,.admin-security-card button,
  .admin-user-card button,.account-content-panel form>button,
  .account-content-panel form button:not([type=button]),.teacher-comment-layout form button,
  .compact-comment-form button,.card-generate,.card-send
):disabled {background:#21242a!important;color:#777d89!important;border-color:#2c3038!important;opacity:1!important;box-shadow:none!important}

@media(max-width:800px) {
  html[data-theme=dark] .publish-actions {background:color-mix(in srgb,var(--theme-panel) 96%,transparent)!important;box-shadow:0 -8px 24px #0005}
  html[data-theme=dark] :is(.mobile-dock,.account-nav) {background:color-mix(in srgb,var(--theme-panel) 96%,transparent)!important;box-shadow:0 -1px 0 var(--theme-border)}
}
