[data-color-theme="light"] {
  --theme-canvas: #edf1f7;
  --theme-panel: #ffffff;
  --theme-surface: #f4f6fa;
  --theme-border: #c3ccdb;
  --theme-text: #19263b;
  --theme-muted: #4e5e74;
  --theme-accent: #2856a0;
  --theme-action: #2b58a3;
  --theme-tint: #dce9fc;
}

[data-color-theme="oled"] {
  --theme-canvas: #000000;
  --theme-panel: #101012;
  --theme-surface: #1b1b1f;
  --theme-border: #3b3b42;
  --theme-text: #f4f4f7;
  --theme-muted: #b4b4c0;
  --theme-accent: #cdbaff;
  --theme-action: #6e4ba5;
  --theme-tint: #292237;
}

[data-color-theme="graphite"] {
  --theme-canvas: #171a20;
  --theme-panel: #20242c;
  --theme-surface: #2b303a;
  --theme-border: #414956;
  --theme-text: #edf0f5;
  --theme-muted: #b8c0cc;
  --theme-accent: #b9cbea;
  --theme-action: #455a7a;
  --theme-tint: #343e50;
}

[data-color-theme] {
  --theme-scheme: dark;
  --theme-brand: #f4f4f4;
  --theme-success: #9ee4bc;
  --theme-danger: #ffacbb;
}

[data-color-theme="light"] {
  --theme-scheme: light;
  --theme-brand: #191919;
  --theme-success: #176345;
  --theme-danger: #a12b49;
}

#welcome-screen:has(:is(#friends-view, #store-view):not([hidden])) :is(.profile-topbar, .profile-nav) {
  --theme-text: #fff8ff;
  --theme-brand: #f4f4f4;
  --theme-muted: #d1c2e0;
  --theme-accent: #dab8f4;
  --theme-border: #42344e;
  --theme-surface: #241b32;
  --theme-tint: #41285e;
}

html[data-color-theme] body.logged-in-page {
  --personal-accent: var(--theme-accent);
  --personal-strong: var(--theme-action);
  --personal-soft: var(--theme-tint);
  background: var(--theme-canvas);
  color: var(--theme-text);
  color-scheme: var(--theme-scheme);
}

html[data-color-theme] body.logged-in-page::before,
html[data-color-theme] body.logged-in-page::after {
  display: none;
}

html[data-color-theme] .welcome-screen,
html[data-color-theme] .conversation-panel {
  background: var(--theme-canvas);
  color: var(--theme-text);
}

html[data-color-theme] .profile-layout > :is(section, article),
html[data-color-theme] :is(.chat-list-panel, .conversation-header),
html[data-color-theme] .welcome-screen > .profile-nav {
  border-color: var(--theme-border);
  background: var(--theme-panel);
  color: var(--theme-text);
  box-shadow: none;
}

html[data-color-theme] .profile-topbar {
  border-color: var(--theme-border);
  color: var(--theme-text);
}

html[data-color-theme] :is(.messenger, .conversation-panel .chat-messages) {
  background: var(--theme-canvas);
  color: var(--theme-text);
}

html[data-color-theme] :is(.profile-brand, .profile-home:hover .profile-brand) {
  color: var(--theme-brand);
}

html[data-color-theme] :is(.profile-nav-button, .preferences-category, .friends-tab, .developer-tabs button) {
  color: var(--theme-muted);
}

html[data-color-theme] :is(.profile-nav-button.active, .profile-nav-button:hover, .profile-nav-button:focus-visible,
    .preferences-category[aria-pressed="true"], .friends-tab[aria-pressed="true"],
    .developer-tabs button[aria-pressed="true"], .dev-user-row[aria-pressed="true"], .dev-user-row:hover) {
  border-color: var(--theme-border);
  background: var(--theme-tint);
  color: var(--theme-text);
  box-shadow: none;
}

html[data-color-theme] .profile-nav-button.active .profile-nav-icon {
  filter: none;
}

html[data-color-theme] :is(.profile-brand-note, .chat-card-note, .profile-card-note, .preferences-description,
    .inbox-item-preview, .inbox-item-time, .inbox-empty, .chat-empty,
    .conversation-note, .chat-bubble:not(.has-media) :where(.chat-bubble-meta, .read-receipt:not(.is-read)),
    .friend-about, .presence-status, .public-profile-tag, .public-profile-about, .wall-post time,
    .wall-empty, .wall-closed-note, .wall-help, .notifications-status, .emoji-picker-note, .emoji-empty,
    .social-dialog p, .wall-delete-dialog > p, .moderation-target, .moderation-help, .moderation-count,
    .developer-heading p, .developer-stats article > span, .dev-muted, .dev-empty,
    .dev-user-copy small, .dev-label small, .dev-account-heading p, .dev-account-meta dt,
    .dev-choice small, .dev-freeze-box p, .dev-history time, .dev-report p) {
  color: var(--theme-muted);
}

html[data-color-theme] :is(.inbox-item-name, .inbox-item.has-unread .inbox-item-name,
    .inbox-item.has-unread .inbox-item-preview, .chat-bubble-text,
    .friend-name, .profile-display-name, .profile-field label, .profile-field small,
    .preferences-row label, .preferences-category span, .dev-user-row,
    .dev-label, .dev-choice, .dev-account-meta dd, .wall-composer label, .moderation-dialog label) {
  color: var(--theme-text);
}

html[data-color-theme] :is(.friend-item, .wall-post, .wall-publish-tools button, .developer-stats article,
    .developer-card, .developer-tabs, .dev-report, .dev-freeze-box, .preferences-info,
    .notification-item, .social-message-preview, .wall-delete-dialog .wall-delete-preview,
    .message-selection-bar, .chat-recorder-bar, .chat-attachment-preview, .android-download,
    .friend-tag-field, .message-input-shell, .chat-bubble:not(.has-media), .chat-count, .message-day) {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
  box-shadow: none;
}

html[data-color-theme] :is(.message-day, .chat-count, #chat-attachment-name, .android-download small) {
  color: var(--theme-muted);
}

html[data-color-theme] :is(.chat-bubble.mine:not(.has-media), .inbox-item.selected, .inbox-item:hover, .inbox-item:focus-visible,
    .notification-item:hover, .notification-item.is-unread, .wall-publish-tools button:hover, .preferences-category:hover) {
  background: var(--theme-tint);
}

html[data-color-theme] .chat-bubble.is-selected {
  outline-color: var(--theme-accent);
}

html[data-color-theme] :is(.friend-info, .chat-list-header, .inbox-item) {
  color: var(--theme-text);
}

html[data-color-theme] :is(.preferences-row, .preferences-session, .conversation-panel .chat-form,
    .dev-account-meta, .dev-history, .inbox-empty, .wall-empty) {
  border-color: var(--theme-border);
}

html[data-color-theme] :is(.profile-field input:not([type="checkbox"]), .profile-field textarea, #profile-gender,
    .chat-list-panel input, .preferences-row select, .developer-panel .dev-input,
    .emoji-search, .wall-composer input, .wall-composer textarea, .moderation-dialog textarea, .profile-link-fallback) {
  border-color: var(--theme-border);
  background: var(--theme-panel);
  color: var(--theme-text);
  color-scheme: var(--theme-scheme);
}

html[data-color-theme] :is(.conversation-panel .message-input-shell textarea, .friend-tag-field input) {
  color: var(--theme-text);
  caret-color: var(--theme-accent);
}

html[data-color-theme] :is(.profile-field input, .profile-field textarea, .chat-list-panel input,
    .conversation-panel .message-input-shell textarea, .friend-tag-field input, .developer-panel .dev-input,
    .emoji-search, .wall-composer input, .wall-composer textarea, .moderation-dialog textarea)::placeholder {
  color: var(--theme-muted);
}

html[data-color-theme] :is(.notifications-dialog, .social-dialog, .wall-composer, .avatar-crop-dialog, .wall-delete-dialog,
    .moderation-dialog, .emoji-picker, .profile-menu, .wall-post-menu, #app-connection-status) {
  border-color: var(--theme-border);
  background: var(--theme-panel);
  color: var(--theme-text);
  color-scheme: var(--theme-scheme);
}

html[data-color-theme] :is(.profile-save, .chat-button, .developer-panel .dev-button, .moderation-submit, .friend-search-button) {
  border-color: var(--theme-action);
  background: var(--theme-action);
  color: #fff;
}

html[data-color-theme] :is(.icon-button, .notification-toggle, .preferences-secondary, .friend-chat-button,
    .profile-friend-action, .wall-post-link, .wall-delete-cancel, .moderation-cancel,
    .developer-panel .dev-button.secondary, .developer-panel .dev-text-button,
    .profile-menu button, .wall-post-menu button, .message-action-list button, .emoji-category) {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
}

html[data-color-theme] #notifications-close {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-text);
}

html[data-color-theme] :is(.icon-button, .notification-toggle, .preferences-secondary, .friend-chat-button,
    .profile-friend-action, .wall-delete-cancel, .moderation-cancel, .developer-panel .dev-button.secondary,
    .developer-panel .dev-text-button, .profile-menu button, .wall-post-menu button,
    .message-action-list button, .emoji-category, .emoji-option):hover {
  background: var(--theme-tint);
}

html[data-color-theme] :is(.chat-message, .profile-message, .wall-status, .wall-post-menu-toggle, #profile-menu-toggle,
    .read-receipt.is-read, .emoji-picker-close, .wall-delete-close, .moderation-close, .wall-post-delete,
    .chat-bubble:not(.has-media) .message-more, .chat-record-button, .chat-attach-button,
    .public-profile .profile-link-copy, .profile-link-copy, .profile-link-feedback, .developer-eyebrow,
    .developer-status, .dev-chip, .dev-user-initial, #app-connection-status button) {
  color: var(--theme-accent);
}

html[data-color-theme] :is(.dev-chip, .dev-user-initial, .dev-history li, .dev-report blockquote) {
  border-color: var(--theme-border);
  background: var(--theme-tint);
}

html[data-color-theme] :is(.presence-status.is-online, .conversation-typing, .moderation-success) {
  color: var(--theme-success);
}

html[data-color-theme] :is(.social-dialog-error, .moderation-error, .developer-status.is-error, .profile-menu .danger-text,
    .message-action-list .danger-text, .wall-post-menu .wall-post-delete, .preferences-session .welcome-logout,
    .wall-delete-dialog .wall-status:not(:empty)) {
  color: var(--theme-danger);
}

html[data-color-theme] .preferences-row input[type="checkbox"] {
  border-color: var(--theme-border);
  background: var(--theme-surface);
}

html[data-color-theme] .preferences-row input[type="checkbox"]::before {
  background: var(--theme-muted);
}

html[data-color-theme] .preferences-row input[type="checkbox"]:checked {
  border-color: var(--theme-action);
  background: var(--theme-action);
}

html[data-color-theme] .preferences-row input[type="checkbox"]:checked::before {
  background: #fff;
}

html[data-color-theme] :is(button, a, input, select, textarea):focus-visible {
  outline-color: var(--theme-accent);
}

html[data-color-theme] .message-input-shell:focus-within {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 2px var(--theme-tint);
}

html[data-color-theme] .wall-publish-tools svg {
  color: var(--theme-accent);
}

@supports selector(::-webkit-scrollbar) {
  html[data-color-theme] ::-webkit-scrollbar-track {
    border-color: var(--theme-border);
    background: var(--theme-canvas);
  }

  html[data-color-theme] ::-webkit-scrollbar-thumb {
    border-color: var(--theme-canvas);
    background: var(--theme-muted);
    box-shadow: none;
  }

  html[data-color-theme] ::-webkit-scrollbar-thumb:hover {
    background: var(--theme-accent);
  }
}

@supports not selector(::-webkit-scrollbar) {
  html[data-color-theme] * {
    scrollbar-color: var(--theme-muted) var(--theme-canvas);
  }
}
