Classic Reddit++

Tools that restore and introduce new functionalities in the old.reddit interface (Views, vote tallies, etc.)

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

// ==UserScript==
// @name         Classic Reddit++
// @namespace    https://github.com/SlippingGitty
// @version      1.6.8
// @description  Tools that restore and introduce new functionalities in the old.reddit interface (Views, vote tallies, etc.)
// @author       SlippingGitty
// @match        http://old.reddit.com/notifications
// @match        https://old.reddit.com/notifications
// @match        https://sh.reddit.com/notifications*
// @match        *://*.reddit.com/*
// @icon         https://files.catbox.moe/6e7371.png
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @grant        GM_registerMenuCommand
// @license      WTFPL
// ==/UserScript==

(function () {
  "use strict";

  //
  // Insures sh.reddit is loaded for notifications, adds old.reddit frontpage button on logo
  //
  if (window.location.href.includes("old.reddit.com/notifications")) {
    window.location.href = window.location.href.replace(
      "old.reddit.com/notifications",
      "sh.reddit.com/notifications"
    );
  }

  if (window.location.href.includes("sh.reddit.com/notifications")) {
    window.addEventListener("load", function () {
      const container = document.createElement("div");
      container.style.display = "flex";
      container.style.alignItems = "center";
      container.style.position = "fixed";
      container.style.top = "10px";
      container.style.left = "10px";
      container.style.zIndex = "9999";
      container.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
      container.style.padding = "5px 10px";
      container.style.borderRadius = "4px";
      container.style.boxShadow =
        "0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)";

      const logo = document.createElement("div");
      logo.innerHTML = `
                    <svg width="24" height="24" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
                        <g>
                            <circle fill="#FF4500" cx="10" cy="10" r="10"/>
                            <path fill="#FFF" d="M16.67,10A1.46,1.46,0,0,0,14.2,9a7.12,7.12,0,0,0-3.85-1.23L11,4.65,13.14,5.1a1,1,0,1,0,.13-0.61L10.82,4a0.31,0.31,0,0,0-.37.24L9.71,7.71a7.14,7.14,0,0,0-3.9,1.23A1.46,1.46,0,1,0,4.2,11.33a2.87,2.87,0,0,0,0,.44c0,2.24,2.61,4.06,5.83,4.06s5.83-1.82,5.83-4.06a2.87,2.87,0,0,0,0-.44A1.46,1.46,0,0,0,16.67,10Zm-10,1a1,1,0,1,1,1,1A1,1,0,0,1,6.67,11Zm5.81,2.75a3.84,3.84,0,0,1-2.47.77,3.84,3.84,0,0,1-2.47-.77,0.27,0.27,0,0,1,.38-0.38A3.27,3.27,0,0,0,10,14a3.28,3.28,0,0,0,2.09-.61A0.27,0.27,0,1,1,12.48,13.79Zm-0.18-1.71a1,1,0,1,1,1-1A1,1,0,0,1,12.29,12.08Z"/>
                        </g>
                    </svg>
                `;
      logo.style.marginRight = "8px";

      const backButton = document.createElement("a");
      backButton.innerText = "Back to Old Reddit";
      backButton.href = window.location.href.replace(
        "sh.reddit.com/notifications",
        "old.reddit.com"
      );
      backButton.title = "Return to Old Reddit";

      backButton.style.display = "inline-block";
      backButton.style.padding = "5px 10px";
      backButton.style.borderRadius = "4px";
      backButton.style.backgroundColor = "#ff4500";
      backButton.style.color = "white";
      backButton.style.fontWeight = "bold";
      backButton.style.textDecoration = "none";
      backButton.style.fontSize = "12px";

      backButton.onmouseover = function () {
        this.style.backgroundColor = "#cc3700";
      };
      backButton.onmouseout = function () {
        this.style.backgroundColor = "#ff4500";
      };

      container.appendChild(logo);
      container.appendChild(backButton);
      document.body.appendChild(container);

      document.addEventListener("keydown", function (e) {
        if (e.key === "Escape") {
          window.location.href = backButton.href;
        }
      });
    });
  }

  //
  // Classic Reddit++
  //
  ///// Trending Subs Recreation
  const config = {
    commentsRange: [20, 50],
    lastTrendingUpdateKey: "lastTrendingUpdate",
    updateInterval: 24 * 60 * 60 * 1000,
    subredditsPool: [
      "/r/AskReddit",
      "/r/funny",
      "/r/pics",
      "/r/gaming",
      "/r/science",
      "/r/worldnews",
      "/r/movies",
      "/r/videos",
      "/r/aww",
      "/r/Music",
      "/r/todayilearned",
      "/r/memes",
      "/r/sports",
      "/r/technology",
      "/r/news",
      "/r/anime",
      "/r/travel",
      "/r/food",
      "/r/space",
      "/r/interestingasfuck",
      "/r/worldpolitics",
      "/r/nfl",
      "/r/art",
      "/r/hobbies",
      "/r/personalfinance",
      "/r/books",
      "/r/history",
      "/r/photography",
      "/r/gadgets",
      "/r/television",
      "/r/wtf",
      "/r/awfuleverything",
      "/r/facepalm",
      "/r/mildlyinteresting",
      "/r/unexpected",
      "/r/dankmemes",
      "/r/publicfreakout",
      "/r/natureismetal",
      "/r/rarepuppers",
      "/r/oldschoolcool",
      "/r/blessedimages",
      "/r/madlads",
      "/r/animalsbeingjerks",
      "/r/whatcouldgowrong",
      "/r/instantkarma",
      "/r/therewasanattempt",
      "/r/wholesomememes",
      "/r/trashy",
      "/r/cringetopia",
      "/r/insaneparents",
      "/r/quityourbullshit",
      "/r/choosingbeggars",
      "/r/entitledparents",
      "/r/amitheasshole",
      "/r/relationship_advice",
      "/r/legaladvice",
      "/r/tifu",
      "/r/raisedbynarcissists",
      "/r/offmychest",
      "/r/venting",
      "/r/selfimprovement",
      "/r/getmotivated",
      "/r/loseit",
      "/r/stopdrinking",
      "/r/leaves",
      "/r/meditation",
      "/r/skincareaddiction",
      "/r/makeupaddiction",
      "/r/haircareScience",
      "/r/malefashionadvice",
      "/r/femalefashionadvice",
      "/r/streetwear",
      "/r/sneakers",
      "/r/watches",
      "/r/cars",
      "/r/buildapc",
      "/r/pcmasterrace",
      "/r/android",
      "/r/apple",
      "/r/programming",
      "/r/webdev",
      "/r/javascript",
      "/r/python",
      "/r/gamingnews",
      "/r/indiegaming",
      "/r/boardgames",
      "/r/tabletopgames",
      "/r/rpg",
      "/r/dndnext",
      "/r/pathfinder_rpg",
      "/r/magicTCG",
      "/r/yugioh",
      "/r/pokemontcg",
      "/r/hearthstone",
      "/r/gwent",
      "/r/competitivegaming",
      "/r/esports",
      "/r/gamernews",
      "/r/anime",
      "/r/manga",
      "/r/cosplay",
      "/r/kpop",
      "/r/jpop",
      "/r/cpop",
      "/r/popheads",
      "/r/indiepop",
      "/r/hiphopheads",
      "/r/rnb",
      "/r/electronicmusic",
      "/r/edm",
      "/r/techno",
      "/r/housemusic",
      "/r/trance",
      "/r/dubstep",
      "/r/jazz",
      "/r/classicalmusic",
      "/r/blues",
      "/r/folk",
      "/r/countrymusic",
      "/r/rock",
      "/r/metal",
      "/r/punk",
      "/r/alternativemusic",
      "/r/indierock",
      "/r/musicals",
      "/r/soundtracks",
      "/r/listentothis",
      "/r/newmusic",
      "/r/food",
      "/r/foodporn",
      "/r/recipes",
      "/r/baking",
      "/r/cooking",
      "/r/cocktails",
      "/r/coffee",
      "/r/tea",
      "/r/vegan",
      "/r/vegetarian",
      "/r/ketorecipes",
      "/r/paleo",
      "/r/glutenfree",
      "/r/healthyeating",
      "/r/nutrition",
      "/r/fitness",
      "/r/loseit",
      "/r/weightlifting",
      "/r/running",
      "/r/yoga",
      "/r/meditation",
      "/r/mindfulness",
      "/r/journaling",
      "/r/productivity",
      "/r/getdisciplined",
      "/r/selfimprovement",
      "/r/skincareaddiction",
      "/r/makeupaddiction",
      "/r/haircareScience",
      "/r/malefashionadvice",
      "/r/femalefashionadvice",
      "/r/streetwear",
      "/r/sneakers",
      "/r/watches",
      "/r/cars",
      "/r/motorcycles",
      "/r/aviation",
      "/r/space",
      "/r/astronomy",
      "/r/physics",
      "/r/chemistry",
      "/r/biology",
      "/r/medicine",
      "/r/science",
      "/r/technology",
      "/r/futurology",
      "/r/singularity",
      "/r/longevity",
      "/r/energy",
      "/r/renewableenergy",
      "/r/environment",
      "/r/climatechange",
      "/r/nature",
      "/r/earthporn",
      "/r/wildlifephotography",
      "/r/aww",
      "/r/animalsbeingbros",
      "/r/rarepuppers",
      "/r/corgi",
      "/r/goldenretrievers",
      "/r/cats",
      "/r/funnyanimals",
      "/r/mademesmile",
      "/r/wholesomememes",
      "/r/humansbeingbros",
      "/r/oldschoolcool",
      "/r/thewaywewere",
      "/r/nostalgia",
      "/r/retrophotos",
      "/r/vintagestyle",
      "/r/oldschoolriders",
      "/r/classiccars",
      "/r/classicfilms",
      "/r/classicrock",
      "/r/oldmovies",
      "/r/90s",
      "/r/80s",
      "/r/70s",
      "/r/60s",
      "/r/50s",
      "/r/40s",
      "/r/30s",
      "/r/20s",
      "/r/10s",
      "/r/00s",
      "/r/y2k",
      "/r/millennials",
      "/r/genz",
      "/r/genx",
      "/r/babyboomers",
      "/r/thegreatgeneration",
      "/r/silentgeneration",
      "/r/lostgeneration",
    ],
    enableTagline: "enableTagline",
    enableRenameHome: "enableRenameHome",
    enableFavicon: "enableFavicon",
    enableTrending: "enableTrending",
    viewCounterEnabled: "viewCounterEnabled",
    voteEstimatorEnabled: "voteEstimatorEnabled",
    hideMultibar: "hideMultibar",
    hideBell: "hideBell",
    hideChat: "hideChat",
    addUserPrefix: "addUserPrefix",
    hideArchivedArrows: "hideArchivedArrows",
    oldCommentFont: "oldCommentFont",
    fullUserScores: "fullUserScores",
    oldRedditIcons: "oldRedditIcons",
    expandoButtons: "expandoButtons",
    classicRESNight: "classicRESNight",
    enableSubmitUnderlay: "enableSubmitUnderlay",
    classicResBorderHighlight: "classicResBorderHighlight",
    classicFlair: "classicFlair",
    darkMode: "darkMode",
  };

  const defaultSettings = {
    [config.enableTagline]: false,
    [config.enableRenameHome]: true,
    [config.enableFavicon]: true,
    [config.enableTrending]: true,
    [config.viewCounterEnabled]: true,
    [config.voteEstimatorEnabled]: true,
    [config.hideMultibar]: false,
    [config.hideBell]: true,
    [config.hideChat]: true,
    [config.addUserPrefix]: false,
    [config.hideArchivedArrows]: false,
    [config.oldCommentFont]: false,
    [config.fullUserScores]: true,
    [config.oldRedditIcons]: true,
    [config.expandoButtons]: false,
    [config.classicRESNight]: false,
    [config.enableSubmitUnderlay]: false,
    [config.classicResBorderHighlight]: true,
    [config.classicFlair]: false,
    [config.darkMode]: false,
  };

  for (const key in defaultSettings) {
    if (GM_getValue(key) === undefined) {
      GM_setValue(key, defaultSettings[key]);
    }
  }

  // STATIC CSS (ALWAYS LOADS REGARDLESS OF TOGGLES)
  GM_addStyle(`

    /* Makes the post info it's classic grey */
      .linkinfo {
        border: 1px solid rgba(12, 10, 10, 0.41);
        background-color: rgba(134, 130, 130, 0.24);
    }


    /* Refered to as "RES" because I originally wanted to see if I could put the toggles in RES Settings */
#res-dashboard-container {
    display: none;
    position: fixed;
    top: 60px;
    right: 20px;
    width: 600px;
    max-height: 500px;
    background-color: #ffffff;
    border: 1px solid #5f99cf; /* Classic Reddit blue border */
    border-radius: 3px;
    z-index: 1001;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: verdana, arial, helvetica, sans-serif; /* Classic Reddit font stack */
    font-size: 12px;
    opacity: 1;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

/* Indents Trending Tab */
div.entry:nth-child(1) {
    margin-left: 75px;
}

/* Night mode styling */
.res-nightmode #res-dashboard-container {
    background-color: #262626; /* Classic RES night mode color */
    border-color: #4d4d4d;
    color: #ddd;
}

#res-dashboard-header {
    background-color: #cee3f8; /* Classic Reddit header blue */
    padding: 5px 8px;
    border-bottom: 1px solid #5f99cf;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 18px; /* Fixed height like old Reddit */
}

/* Night mode header */
.res-nightmode #res-dashboard-header {
    background-color: #2a2a2a;
    border-bottom-color: #4d4d4d;
}

#res-dashboard-title {
    font-size: 13px;
    font-weight: bold;
    color: #336699; /* Classic Reddit blue */
    margin: 0;
    text-transform: none;
    line-height: 18px;
}

/* Night mode title */
.res-nightmode #res-dashboard-title {
    color: #8cb3d9; /* Lighter blue for night mode */
}

#res-dashboard-close {
    cursor: pointer;
    font-size: 12px;
    color: #369;
    font-weight: bold;
    margin-right: 5px;
}

#res-dashboard-close:hover {
    color: #ff4500; /* Classic Reddit orangered */
    text-decoration: underline; /* Old Reddit often used underlines on hover */
}

/* Night mode close button */
.res-nightmode #res-dashboard-close {
    color: #8cb3d9;
}

.res-nightmode #res-dashboard-close:hover {
    color: #ff7247; /* Lighter orangered for night mode */
}

#res-dashboard-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 7px;
    padding: 8px;
    background-color: #f6f7f8; /* Very light gray like classic Reddit content areas */
    overflow: visible;
}

/* Night mode content area */
.res-nightmode #res-dashboard-content {
    background-color: #262626;
    overflow: visible;
}

.res-setting-section {
    background-color: #ffffff;
    border: 1px solid #c3c3c3; /* Classic light gray border */
    border-radius: 0px; /* Old Reddit had square corners */
    padding: 8px;
    margin: 0;
    position: relative;
}

/* Night mode setting sections */
.res-nightmode .res-setting-section {
    background-color: #1a1a1a;
    border-color: #4d4d4d;
}

.res-setting-section:hover {
    border-color: #a5a5a5; /* Subtle hover effect common in old interfaces */
}

/* Night mode hover effect */
.res-nightmode .res-setting-section:hover {
    border-color: #666;
}

.res-setting-section h3 {
    font-size: 12px;
    margin: 0 0 5px 0;
    padding: 0;
    color: #222222; /* Dark gray, almost black */
    font-weight: bold;
}

/* Night mode headings */
.res-nightmode .res-setting-section h3 {
    color: #ddd;
}

/* Native tooltip styling */
.res-setting-section label {
    font-size: 11px;
    color: #222;
    cursor: pointer;
}

.res-setting-section label[title] {
    text-decoration: underline dotted #777; /* Indicate tooltip on hover */
}

/* Night mode labels */
.res-nightmode .res-setting-section label {
    color: #ddd;
}

.res-nightmode .res-setting-section label[title] {
    text-decoration: underline dotted #aaa; /* Indicate tooltip on hover for night mode */
}

/* Classic toggle switch styling */
.res-toggle-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.res-toggle-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 14px;
}

.res-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.res-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #c3c3c3;
    transition: .2s;
    border-radius: 7px;
}

/* Night mode slider */
.res-nightmode .res-slider {
    background-color: #444;
}

.res-slider:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .res-slider {
    background-color: #5f99cf; /* Classic Reddit blue */
}

input:focus + .res-slider {
    box-shadow: 0 0 1px #5f99cf;
}

input:checked + .res-slider:before {
    transform: translateX(18px);
}

/* Night mode checked slider */
.res-nightmode input:checked + .res-slider {
    background-color: #4c7eac; /* Darker blue for night mode */
}

/* Classic Reddit button with gradient */
#res-settings-toggle {
    position: fixed;
    top: 45px;
    right: 20px;
    opacity: 0;
    z-index: 1000;
    background: linear-gradient(to bottom, #75abff 0%, #5f99cf 100%); /* Classic button gradient */
    border: 1px solid #369;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    text-transform: capitalize;
}

#res-settings-toggle:hover {
    background: linear-gradient(to bottom, #5f99cf 0%, #3a80c1 100%);
    opacity: 1;
    transition: .1s;
}

/* Night mode toggle button */
.res-nightmode #res-settings-toggle {
    background: linear-gradient(to bottom, #4c7eac 0%, #36648b 100%); /* Darker gradient for night mode */
    border-color: #2c5574;
}

.res-nightmode #res-settings-toggle:hover {
    background: linear-gradient(to bottom, #36648b 0%, #2c5574 100%);
}

#res-dashboard-logo {
    max-height: 14px;
    margin-right: 6px;
}

/* Additional elements to match old Reddit style */


/* Old Reddit-style scrollbars */
#res-dashboard-container::-webkit-scrollbar {
    width: 12px;
    background-color: #f5f5f5;
}

#res-dashboard-container::-webkit-scrollbar-thumb {
    background-color: #c3c3c3;
    border: 2px solid #f5f5f5;
}

#res-dashboard-container::-webkit-scrollbar-track {
    background-color: #f5f5f5;
}

/* Night mode scrollbars */
.res-nightmode #res-dashboard-container::-webkit-scrollbar {
    background-color: #1a1a1a;
}

.res-nightmode #res-dashboard-container::-webkit-scrollbar-thumb {
    background-color: #444;
    border: 2px solid #1a1a1a;
}

.res-nightmode #res-dashboard-container::-webkit-scrollbar-track {
    background-color: #1a1a1a;
}

/* Classic Reddit table styles for structured content if needed */
.res-table {
    border-collapse: collapse;
    width: 100%;
    margin: 5px 0;
    font-size: 11px;
}

.res-table th {
    background-color: #efefef;
    border: 1px solid #c3c3c3;
    padding: 3px 5px;
    text-align: left;
    font-weight: bold;
}

.res-table td {
    border: 1px solid #c3c3c3;
    padding: 3px 5px;
}

.res-nightmode .res-table th {
    background-color: #2a2a2a;
    border-color: #4d4d4d;
}

.res-nightmode .res-table td {
    border-color: #4d4d4d;
}
`);

  let dashboardContainer = document.createElement("div");
  dashboardContainer.id = "res-dashboard-container";

  let dashboardHeader = document.createElement("div");
  dashboardHeader.id = "res-dashboard-header";

  let dashboardTitle = document.createElement("h2");
  dashboardTitle.id = "res-dashboard-title";
  dashboardTitle.textContent = "Classic Reddit++ Settings";

  let logoImg = document.createElement("img");
  logoImg.id = "res-dashboard-logo";
  logoImg.src = "https://files.catbox.moe/6e7371.png";
  logoImg.alt = "Classic Reddit++ Logo";

  dashboardHeader.appendChild(logoImg);
  dashboardHeader.appendChild(dashboardTitle);

  let closeButton = document.createElement("span");
  closeButton.id = "res-dashboard-close";
  closeButton.textContent = "x";
  closeButton.addEventListener("click", () => {
    dashboardContainer.style.display = "none";
  });
  dashboardHeader.appendChild(closeButton);

  dashboardContainer.appendChild(dashboardHeader);

  let dashboardContent = document.createElement("div");
  dashboardContent.id = "res-dashboard-content";
  dashboardContainer.appendChild(dashboardContent);

  document.body.appendChild(dashboardContainer);

  function createSettingElement(settingKey, description, updateFunction) {
    let section = document.createElement("div");
    section.classList.add("res-setting-section");

    let title = document.createElement("h3");
    title.textContent =
      {
        enableTagline: "Modify Title Tag",
        enableRenameHome: "Rename Home Shortcut",
        enableFavicon: "Restore Classic Favicon",
        enableTrending: "Simulate Trending Subreddits",
        viewCounterEnabled: "Display Post View Counts",
        voteEstimatorEnabled: "Estimate Post Votes",
        hideMultibar: "Hide Subreddit Multibar",
        hideBell: "Hide Notification Bell",
        hideChat: "Hide Reddit Chat",
        addUserPrefix: "Add Username Prefix",
        hideArchivedArrows: "Hide Archived Post Arrows",
        oldCommentFont: "Use Old Comment Font",
        fullUserScores: "Show Full User Scores",
        oldRedditIcons: "Restore Old Reddit Icons",
        expandoButtons: "Use Old Expando Buttons",
        classicRESNight: "Use Classic RES Night Mode",
        enableSubmitUnderlay: "Restore Submit Link Tagline",
        classicResBorderHighlight: "Enable Classic RES Border Highlight",
        classicFlair: "Remove Flair Colors",
        darkMode: "RES Dark Mode Recreation",
      }[settingKey] || settingKey;
    section.appendChild(title);

    let desc = document.createElement("p");
    desc.textContent = description;
    section.appendChild(desc);

    let toggleContainer = document.createElement("div");
    toggleContainer.classList.add("res-toggle-container");

    let toggleLabel = document.createElement("label");
    toggleLabel.classList.add("res-toggle-switch");

    let toggleInput = document.createElement("input");
    toggleInput.type = "checkbox";
    toggleInput.checked = GM_getValue(settingKey, defaultSettings[settingKey]);
    toggleInput.addEventListener("change", function () {
      GM_setValue(settingKey, this.checked);
      if (updateFunction) updateFunction(this.checked);
    });

    let toggleSlider = document.createElement("span");
    toggleSlider.classList.add("res-slider");

    toggleLabel.appendChild(toggleInput);
    toggleLabel.appendChild(toggleSlider);
    toggleContainer.appendChild(toggleLabel);

    section.appendChild(toggleContainer);
    return section;
  }

  // Populate the dashboard
  const settingsArray = [
    {
      key: config.enableTagline,
      description:
        "Modifies the title tag to say 'reddit: the front page of the internet'",
      func: setTagline,
    },
    {
      key: config.enableRenameHome,
      description:
        "Renames the 'home' shortcut to 'FRONT'. Please Disable subredditManager in RES for time being.",
      func: renameHomeButton,
    },
    {
      key: config.enableFavicon,
      description: "Brings back the classic Favicon.",
      func: changeFavicon,
    },
    {
      key: config.enableTrending,
      description:
        "Simulates a collection of 'trending' subreddits to the top of your front page.",
      func: addTrendingSubreddits,
    },
    {
      key: config.viewCounterEnabled,
      description: "Displays view counts on posts.",
      func: initializeViewCounter,
    },
    {
      key: config.voteEstimatorEnabled,
      description:
        "Estimates upvotes and downvotes on posts, and adds a counter to every post.",
      func: initializeVoteEstimator,
    },
    {
      key: config.hideMultibar,
      description: "Hide the subreddit multibar.",
      func: toggleHideMultibar,
    },
    {
      key: config.hideBell,
      description: "Hide the notification bell.",
      func: toggleHideBell,
    },
    {
      key: config.hideChat,
      description: "Hide Reddit chat.",
      func: toggleHideChat,
    },
    {
      key: config.addUserPrefix,
      description: "Add /u/ before usernames.",
      func: toggleAddUserPrefix,
    },
    {
      key: config.hideArchivedArrows,
      description: "Hide arrows on archived posts.",
      func: toggleHideArchivedArrows,
    },
    {
      key: config.oldCommentFont,
      description: "Use old comment font sizes.",
      func: toggleOldCommentFont,
    },
    {
      key: config.fullUserScores,
      description: "Show full scores on posts.",
      func: toggleFullUserScores,
    },
    {
      key: config.oldRedditIcons,
      description: "Use old Reddit icons.",
      func: toggleOldRedditIcons,
    },
    {
      key: config.expandoButtons,
      description: "Use old expando buttons.",
      func: toggleExpandoButtons,
    },
    {
      key: config.classicRESNight,
      description: "Use Classic RES Night Mode.",
      func: toggleClassicRESNight,
    },
    {
      key: config.enableSubmitUnderlay,
      description: "Restore tagline under Submit Link",
      func: toggleSubmitUnderlay,
    },
    {
      key: config.classicResBorderHighlight,
      description: "Enable Classic RES Border Highlight",
      func: toggleClassicResBorderHighlight,
    },
    {
      key: config.classicFlair,
      description: "Removes colors from flairs on posts. RES support limited.",
      func: classicFlair,
    },
    {
      key: config.darkMode,
      description: "A recreation of the RES Dark Mode Theme by /u/PersonalPi.",
      func: toggleDarkMode,
    },
  ];

  settingsArray.forEach((setting) => {
    dashboardContent.appendChild(
      createSettingElement(setting.key, setting.description, setting.func)
    );
  });

  let toggleButton = document.createElement("button");
  toggleButton.id = "res-settings-toggle";
  toggleButton.textContent = "CR++";
  toggleButton.addEventListener("click", () => {
    dashboardContainer.style.display =
      dashboardContainer.style.display === "block" ? "none" : "block";
  });
  document.body.appendChild(toggleButton);

  const refreshButton = document.createElement("button");
  refreshButton.textContent = "Refresh Trending";
  refreshButton.style.fontSize = "10px";
  refreshButton.style.marginTop = "5px";
  refreshButton.addEventListener("click", forceUpdateTrending);
  dashboardHeader.appendChild(refreshButton);

  function setTagline(enabled) {
    if (enabled) {
      document.title = "reddit: the front page of the internet";
    } else {
      const defaultTitle = document.title.split(":")[0];
      document.title = defaultTitle;
    }
  }

  function renameHomeButton(enabled) {
    const homeLink = document.querySelector(
      "ul.flat-list:nth-child(1) > li:nth-child(1) > a:nth-child(1)"
    );
    if (homeLink) {
      homeLink.textContent = enabled ? "front" : "home";
      homeLink.title = enabled
        ? "Go to front page"
        : "go to your personal reddit frontpage";
    }
  }

  function changeFavicon(enabled) {
    let icon = [...document.querySelectorAll('link[rel~="icon"]')];
    icon.forEach((x) => x.parentNode.removeChild(x));

    if (enabled) {
      let newfav = `https://b.thumbs.redditmedia.com/JeP1WF0kEiiH1gT8vOr_7kFAwIlHzRBHjLDZIkQP61Q.jpg`;
      let link = document.createElement("link");
      link.rel = "icon";
      link.href = newfav;
      document.head.appendChild(link);
    } else {
      var link = document.createElement("link");
      link.rel = "icon";
      link.href = "//www.redditstatic.com/favicon.ico";
      document.head.appendChild(link);
    }
  }

  function getRandomSubreddits() {
    const now = Date.now();
    const lastUpdate = GM_getValue(config.lastTrendingUpdateKey, 0);
    const storedSubreddits = GM_getValue("trendingSubreddits", null);

    if (now - lastUpdate > config.updateInterval || !storedSubreddits) {
      const shuffled = [...config.subredditsPool].sort(
        () => 0.5 - Math.random()
      );
      const selected = shuffled.slice(0, 5);
      const commentCount = Math.floor(
        Math.random() *
          (config.commentsRange[1] - config.commentsRange[0] + 1) +
          config.commentsRange[0]
      );
      const trendingData = {
        subreddits: selected,
        commentCount: commentCount + " comments",
      };
      GM_setValue("trendingSubreddits", JSON.stringify(trendingData));
      GM_setValue(config.lastTrendingUpdateKey, now);
      return trendingData;
    }
    return JSON.parse(storedSubreddits);
  }

  function createTrendingSubredditsElement(trendingData) {
    const container = document.createElement("div");
    container.className = "thing";
    container.style.margin = "0";
    container.style.padding = "0";
    container.style.marginBottom = "7px";
    const content = document.createElement("div");
    content.className = "entry unvoted";
    const lineContainer = document.createElement("div");
    lineContainer.style.display = "flex";
    lineContainer.style.flexWrap = "wrap";
    lineContainer.style.alignItems = "center";
    lineContainer.style.gap = "5px";
    const trendingIcon = document.createElement("span");
    trendingIcon.style.backgroundImage =
      "url(https://web.archive.org/web/20151231010236im_/https://www.redditstatic.com/sprite-reddit.akRjeb2JalM.png)";
    trendingIcon.style.backgroundPosition = "-50px -886px";
    trendingIcon.style.height = "14px";
    trendingIcon.style.width = "14px";
    trendingIcon.style.display = "inline-block";
    lineContainer.appendChild(trendingIcon);
    const headerText = document.createElement("strong");
    headerText.textContent = "trending subreddits";
    headerText.style.color = "#222";
    headerText.style.marginRight = "10px";
    lineContainer.appendChild(headerText);
    trendingData.subreddits.forEach((subreddit) => {
      const link = document.createElement("a");
      link.href = subreddit;
      link.textContent = subreddit;
      link.style.textDecoration = "none";
      link.style.color = "#0079d3";
      lineContainer.appendChild(link);
    });
    const commentsLink = document.createElement("a");
    commentsLink.href = "/r/trendingsubreddits";
    commentsLink.innerHTML = `<b>${trendingData.commentCount}</b>`;
    commentsLink.style.color = "#888";
    commentsLink.style.textDecoration = "none";
    commentsLink.style.fontSize = "11px";
    commentsLink.style.marginLeft = "10px";
    lineContainer.appendChild(commentsLink);
    content.appendChild(lineContainer);
    container.appendChild(content);

    if (document.body.classList.contains("res-nightmode")) {
      headerText.style.color = "#A9A9A9";
      const links = lineContainer.querySelectorAll("a");
      links.forEach((link) => {
        link.style.color = "#89b8e5";
      });
      commentsLink.style.color = "#b0b0b0";
    }

    return container;
  }

  function addTrendingSubreddits(enabled) {
    const isFrontPage =
      window.location.pathname === "/" ||
      window.location.pathname === "/index.html";
    if (
      enabled &&
      isFrontPage &&
      (window.location.hostname === "old.reddit.com" ||
        window.location.hostname === "www.reddit.com")
    ) {
      const siteTable = document.getElementById("siteTable");
      if (!siteTable) {
        return;
      }
      const trendingData = getRandomSubreddits();
      const trendingElement = createTrendingSubredditsElement(trendingData);
      if (siteTable.firstChild) {
        siteTable.insertBefore(trendingElement, siteTable.firstChild);
      } else {
        siteTable.appendChild(trendingElement);
      }
    } else {
      const trendingElement = document.querySelector(".thing");
      if (trendingElement) {
        trendingElement.remove();
      }
    }
  }

  function forceUpdateTrending() {
    GM_setValue(config.lastTrendingUpdateKey, 0);
    location.reload();
  }

  function addDebugControls() {
    const debugBtn = document.createElement("button");
    debugBtn.textContent = "Update Trending Subreddits";
    debugBtn.style.position = "fixed";
    debugBtn.style.top = "5px";
    debugBtn.style.right = "5px";
    debugBtn.style.zIndex = "9999";
    debugBtn.style.fontSize = "10px";
    debugBtn.style.opacity = "0.7";
    debugBtn.onclick = forceUpdateTrending;
    document.body.appendChild(debugBtn);
  }

  function addCommas(number) {
    return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  }

  function httpGet(url) {
    return new Promise((resolve, reject) => {
      GM_xmlhttpRequest({
        method: "GET",
        url: url,
        onload: function (response) {
          if (response.status >= 200 && response.status < 300) {
            resolve(response.responseText);
          } else {
            reject(new Error(`HTTP error! status: ${response.status}`));
          }
        },
        onerror: function () {
          reject(new Error("Network error occurred"));
        },
      });
    });
  }

  function getPostId(element) {
    if (element) {
      if (element.dataset.fullname) {
        return element.dataset.fullname.replace("t3_", "");
      }

      const idClass = Array.from(element.classList).find((c) =>
        c.startsWith("id-t3_")
      );
      if (idClass) {
        return idClass.replace("id-t3_", "");
      }

      const thingId = element.getAttribute("data-fullname");
      if (thingId && thingId.startsWith("t3_")) {
        return thingId.replace("t3_", "");
      }

      const permalink = element.querySelector("a.permalink");
      if (permalink && permalink.href) {
        const permalinkMatch = permalink.href.match(
          /\/comments\/([a-z0-9]+)\//i
        );
        if (permalinkMatch) {
          return permalinkMatch[1];
        }
      }
    }

    const urlMatch = window.location.pathname.match(
      /\/comments\/([a-z0-9]+)\//i
    );
    return urlMatch ? urlMatch[1] : null;
  }

  //
  // Makes sure the Trending subreddits and Classic tagline only works
  // on the front page
  //
  if (
    (window.location.hostname === "old.reddit.com" ||
      window.location.hostname === "www.reddit.com") &&
    (window.location.pathname === "/" ||
      window.location.pathname === "/index.html")
  ) {
    setTagline(GM_getValue(config.enableTagline));
    renameHomeButton(GM_getValue(config.enableRenameHome));
    changeFavicon(GM_getValue(config.enableFavicon));

    window.addEventListener("load", () => {
      addTrendingSubreddits(GM_getValue(config.enableTrending));
    });
  }

  //
  // View Counter Logic
  //
  function initializeViewCounter() {
    if (typeof GM_getValue !== 'undefined' && typeof config !== 'undefined') {
      if (!GM_getValue(config.viewCounterEnabled, true)) return;
    }

    const viewCountCache = {};
    let pendingPostIds = [];
    let fetchTimeout = null;

    function formatNumber(num) {
      if (num === null || num === undefined || isNaN(num)) return "? views";
      if (num >= 1000000) return (num / 1000000).toFixed(1) + "M views";
      if (num >= 1000) return (num / 1000).toFixed(1) + "K views";
      return num + " views";
    }

    function getPostId(element = null) {
      if (element) {
        const fullname = element.getAttribute("data-fullname");
        if (fullname) return fullname.replace("t3_", "");
        const idClass = Array.from(element.classList).find(c => c.startsWith("id-t3_"));
        if (idClass) return idClass.replace("id-t3_", "");
      }
      const match = window.location.pathname.match(/\/comments\/([a-z0-9]+)/i);
      return match ? match[1] : null;
    }

    function insertViewCount(element, formattedViews) {
      const tagline = element.querySelector(".tagline");
      if (!tagline) return;
      if (tagline.querySelector(".view-count")) return;

      const viewElement = document.createElement("span");
      viewElement.className = "view-count";
      viewElement.textContent = formattedViews;
      viewElement.style.marginRight = "6px";
      viewElement.style.color = "#888";
      viewElement.style.fontWeight = "bold";

      tagline.insertBefore(viewElement, tagline.firstChild);
    }

    function fetchPendingPosts() {
      if (pendingPostIds.length === 0) return;

      const batch = pendingPostIds.slice(0, 50);
      pendingPostIds = pendingPostIds.slice(50);

      const ids = batch.map(b => "t3_" + b.id).join(",");
      const origin = window.location.origin.includes("reddit.com") ? window.location.origin : "https://old.reddit.com";
      const jsonUrl = `${origin}/by_id/${ids}.json`;

      GM_xmlhttpRequest({
        method: "GET",
        url: jsonUrl,
        headers: { "Accept": "application/json" },
        onload: function(response) {
          try {
            if (response.status !== 200) throw new Error("HTTP " + response.status);
            const data = JSON.parse(response.responseText);
            const children = data?.data?.children || [];

            const dataMap = {};
            children.forEach(child => {
              if (child.data && child.data.id) {
                dataMap[child.data.id] = child.data;
              }
            });

            batch.forEach(item => {
              const postData = dataMap[item.id];
              let viewCount = null;

              if (postData) {
                if (postData.view_count != null) viewCount = postData.view_count;
                else if (postData.viewCount != null) viewCount = postData.viewCount;
                else if (postData.num_views != null) viewCount = postData.num_views;
                else {
                  const score = postData.score || 0;
                  const ratio = postData.upvote_ratio || 0.5;
                  const comments = postData.num_comments || 0;
                  let estUps = 0;

                  if (ratio > 0 && ratio !== 0.5) {
                    estUps = Math.abs(Math.round(score / (2 * ratio - 1)));
                  } else {
                    estUps = Math.max(0, score);
                  }

                  viewCount = Math.max(estUps * 25, comments * 50);
                }

                if (!viewCount || viewCount <= 0) {
                  viewCount = Math.floor(Math.random() * 10) + 1;
                }
              }

              if (viewCount !== null) {
                viewCountCache[item.id] = viewCount;
                insertViewCount(item.element, formatNumber(viewCount));
              } else {
                insertViewCount(item.element, "? views");
              }
            });
          } catch (err) {
            console.error("View counter bulk fetch error:", err);
            batch.forEach(item => insertViewCount(item.element, "? views"));
          }

          if (pendingPostIds.length > 0) {
            setTimeout(fetchPendingPosts, 1000);
          }
        },
        onerror: function() {
          batch.forEach(item => insertViewCount(item.element, "? views"));
        }
      });
    }

    function processPost(postElement) {
      const postId = getPostId(postElement);
      if (!postId) return;

      if (viewCountCache[postId]) {
        insertViewCount(postElement, formatNumber(viewCountCache[postId]));
        return;
      }

      pendingPostIds.push({ id: postId, element: postElement });

      clearTimeout(fetchTimeout);
      fetchTimeout = setTimeout(fetchPendingPosts, 300);
    }

    function processAllPosts() {
      if (window.location.pathname.includes("/comments/")) {
        const postId = getPostId();
        if (!postId) return;
        const selfPost = document.querySelector(".thing.self") || document.querySelector(".thing.link");
        if (selfPost && !selfPost.hasAttribute("data-processed-views")) {
          selfPost.setAttribute("data-processed-views", "true");
          processPost(selfPost);
        }
        return;
      }

      const posts = document.querySelectorAll(".thing.link:not([data-processed-views])");
      posts.forEach((post) => {
        post.setAttribute("data-processed-views", "true");
        processPost(post);
      });
    }

    function handleResExpando() {
      document.addEventListener("click", function (e) {
        setTimeout(() => {
          const expandedPosts = document.querySelectorAll(".res-expando-box:not([data-processed-views])");
          expandedPosts.forEach((post) => {
            post.setAttribute("data-processed-views", "true");
            const parentPost = post.closest(".thing");
            if (parentPost) {
              const postId = getPostId(parentPost);
              if (postId && viewCountCache[postId]) {
                processPost(parentPost);
              }
            }
          });
        }, 500);
      });
    }

    function handleNeverEndingReddit() {
      const observer = new MutationObserver((mutations) => {
        let hasNewNodes = false;
        mutations.forEach(m => { if (m.addedNodes && m.addedNodes.length > 0) hasNewNodes = true; });
        if (hasNewNodes) processAllPosts();
      });
      const container = document.getElementById("siteTable") || document.body;
      if (container) observer.observe(container, { childList: true, subtree: true });
    }

    setTimeout(() => {
      processAllPosts();
      handleResExpando();
      handleNeverEndingReddit();
      setInterval(processAllPosts, 2000);
    }, 500);
  }

  //
  // Vote Estimator Logic
  //
  function initializeVoteEstimator() {
    if (!GM_getValue(config.voteEstimatorEnabled)) return;

    function addCommas(number) {
      return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    }

    function estimatePostScoreVotes() {
      document.querySelectorAll(".linkinfo .score").forEach((linkinfoScore) => {
        const numberElement = linkinfoScore.querySelector(".number");
        if (!numberElement) return;

        const points = parseInt(
          numberElement.textContent.replace(/[^0-9]/g, ""),
          10
        );
        const percentageMatch =
          linkinfoScore.textContent.match(/([0-9]{1,3})\s?%/);
        const percentage = percentageMatch
          ? parseInt(percentageMatch[1], 10)
          : 0;

        if (points !== 50 && percentage !== 50) {
          const upvotes = Math.round(
            (points * percentage) / (2 * percentage - 100)
          );
          const downvotes = upvotes - points;
          const totalVotes = upvotes + downvotes;

          const css = `
                            .linkinfo .upvotes { font-size: 80%; color: orangered; margin-left: 5px; }
                            .linkinfo .downvotes { font-size: 80%; color: #5f99cf; margin-left: 5px; }
                            .linkinfo .totalvotes { font-size: 80%; margin-left: 5px; }
                        `;

          const style = document.createElement("style");
          style.innerHTML = css;
          document.head.appendChild(style);

          linkinfoScore.insertAdjacentHTML(
            "afterend",
            `
                            <span class="upvotes"><span class="number">${addCommas(
                              upvotes
                            )}</span> <span class="word">${
              upvotes > 1 ? "upvotes" : "upvote"
            }</span></span>
                            <span class="downvotes"><span class="number">${addCommas(
                              downvotes
                            )}</span> <span class="word">${
              downvotes > 1 ? "downvotes" : "downvote"
            }</span></span>
                            <span class="totalvotes"><span class="number">${addCommas(
                              totalVotes
                            )}</span> <span class="word">${
              totalVotes > 1 ? "votes" : "vote"
            }</span></span>
                        `
          );
        }
      });
    }

    async function addUpvoteDownvoteInfo() {
      const linkListing =
        document.querySelector(".linklisting") ||
        document.querySelector(".Post")?.parentElement;
      if (!linkListing) return;

      const linkDivs = linkListing.getElementsByClassName("link");

      const promises = Array.from(linkDivs).map(async (linkDiv) => {
        const commentsLink = linkDiv.querySelector(".comments");
        if (!commentsLink) return;

        const commentsPage = await httpGet(
          `${commentsLink.href}?limit=1&depth=1`
        );

        const scoreSection =
          /<div class=(\"|\')score(\"|\')[\s\S]*?<\/div>/.exec(commentsPage);
        if (!scoreSection) return;

        const scoreMatch =
          /<span class=(\"|\')number(\"|\')>([\d\,\.]*)<\/span>/.exec(
            scoreSection[0]
          );
        if (!scoreMatch) return;

        const score = parseInt(
          scoreMatch[3].replace(",", "").replace(".", ""),
          10
        );
        const upvotesPercentageMatch = /\((\d+)\s*\%[^\)]*\)/.exec(
          scoreSection[0]
        );
        if (!upvotesPercentageMatch) return;

        const upvotesPercentage = parseInt(upvotesPercentageMatch[1], 10);
        const upvotes = calcUpvotes(score, upvotesPercentage);
        const downvotes = upvotes !== "--" ? score - upvotes : "--";

        updateTagline(linkDiv, upvotes, downvotes, upvotesPercentage);
      });

      await Promise.all(promises);
    }

    function calcUpvotes(score, upvotesPercentage) {
      if (score === 0) return "--";
      return Math.round(
        ((upvotesPercentage / 100) * score) /
          (2 * (upvotesPercentage / 100) - 1)
      );
    }

    function updateTagline(linkDiv, upvotes, downvotes, upvotesPercentage) {
      const taglineParagraph =
        linkDiv.querySelector(".tagline") ||
        linkDiv
          .querySelector(".Post div[data-test-id='post-content']")
          ?.querySelector(".tagline");
      if (!taglineParagraph) return;

      let upvoteSpan = taglineParagraph.querySelector(".res_post_ups");
      let downvoteSpan = taglineParagraph.querySelector(".res_post_downs");
      let percentageSpan = taglineParagraph.querySelector(
        ".res_post_percentage"
      );

      if (!upvoteSpan || !downvoteSpan || !percentageSpan) {
        const updownInfoSpan = document.createElement("span");

        upvoteSpan = createVoteSpan("res_post_ups", upvotes, "#FF8B24");
        downvoteSpan = createVoteSpan("res_post_downs", downvotes, "#9494FF");
        percentageSpan = createVoteSpan(
          "res_post_percentage",
          `${upvotesPercentage}%`,
          "#00A000"
        );

        updownInfoSpan.append(
          "(",
          upvoteSpan,
          "|",
          downvoteSpan,
          "|",
          percentageSpan,
          ") "
        );
        taglineParagraph.insertBefore(
          updownInfoSpan,
          taglineParagraph.firstChild
        );
      } else {
        upvoteSpan.textContent = upvotes;
        downvoteSpan.textContent = downvotes;
        percentageSpan.textContent = `${upvotesPercentage}%`;
      }
    }

    function createVoteSpan(className, textContent, color) {
      const span = document.createElement("span");
      span.classList.add(className);
      span.style.color = color;
      span.textContent = textContent;
      return span;
    }

    async function httpGet(url) {
      const response = await fetch(url);
      return response.text();
    }

    window.addEventListener("load", () => {
      estimatePostScoreVotes();
      addUpvoteDownvoteInfo();
    });

    window.addEventListener("keydown", (event) => {
      if (event.shiftKey && event.key === "P") {
        estimatePostScoreVotes();
        addUpvoteDownvoteInfo();
      }
    });
  }

  //
  // Classic Reddit Rewrite
  //
  const styleIds = {
    hideMultibar: "classicRedditMultibar",
    hideBell: "classicRedditBell",
    hideChat: "classicRedditChat",
    addUserPrefix: "classicRedditUserPrefix",
    hideArchivedArrows: "classicRedditArchivedArrows",
    oldCommentFont: "classicRedditOldCommentFont",
    fullUserScores: "classicRedditFullUserScores",
    oldRedditIcons: "classicRedditOldRedditIcons",
    expandoButtons: "classicRedditExpandoButtons",
    classicRESNight: "classicRESNightStyles",
    submitUnderlay: "classicRedditSubmitUnderlay",
    classicResBorderHighlight: "classicResBorderHighlight",
    classicFlair: "classicFlair",
    darkMode: "classicRedditDarkMode",
  };

  function toggleHideMultibar(enabled) {
    GM_setValue(config.hideMultibar, enabled);
    const styleId = styleIds.hideMultibar;
    if (enabled) {
      GM_addStyle(
        `
                    .listing-chooser {
                        display: none;
                    }
                    .content[role=main] {
                        margin-left: 5px!important;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function classicFlair(enabled) {
    GM_setValue(config.classicFlair, enabled);
    const styleId = styleIds.classicFlair;
    if (enabled) {
      GM_addStyle(
        `
                .flair,
                .RES-flair {
                background-color: transparent !important;
                color: #888 !important;
                border: 1px solid #ddd !important;
                font-size: x-small !important;
                padding: 1px !important;
                }

                .res-flairSearch.linkflairlabel > a {
                position: absolute;
                inset: 0 0 0 0;
                background-color: ;
                color: #e3000000 !important;
                    font-size: x-small !important;
                        padding: 1px !important;
                }
                .res-flairSearch.linkflairlabel {
                cursor: pointer;
                position: relative;
                background-color: #f000 !important;
                        font-size: x-small !important;
                        padding: 1px !important;
                }

                /* Target link flairs specifically */
                .linkflairlabel,
                .res-linkFlairLabel {
                background-color: transparent !important;
                color: #888 !important;
                border: 1px solid #ddd !important;
                font-size: x-small !important;
                        padding: 1px !important;
                }

                /* Target user flairs */
                .author-flair,
                .res-userFlairText {
                background-color: transparent !important;
                color: #888 !important;
                border: 1px solid #ddd !important;
                    font-size: x-small !important;
                        padding: 1px !important;
                }

                /* RES night mode compatibility */
                .res-nightmode .flair,
                .res-nightmode .linkflairlabel,
                .res-nightmode .author-flair {
                background-color: transparent !important;
                color: #aaa !important;
                    font-size: x-small !important;
                }

                /* Target RES-specific container elements */
                .res .tagline .flair,
                .res .thing .tagline .flair,
                .res .entry .tagline .flair {
                background-color: transparent !important;
                color: #888 !important;
                border: 1px solid #ddd !important;
                    font-size: x-small !important;
                        padding: 1px !important;
                }

                /* RES user tagger compatibility */
                .RESUserTag .flair {
                background-color: transparent !important;
                color: #888 !important;
                border: 1px solid #ddd !important;
                    font-size: x-small !important;
                        padding: 1px !important;
                }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleHideBell(enabled) {
    GM_setValue(config.hideBell, enabled);
    const styleId = styleIds.hideBell;
    if (enabled) {
      GM_addStyle(
        `
                    #notifications, span.separator:nth-child(6), span.separator:nth-child(7) {
                        display: none;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleHideChat(enabled) {
    GM_setValue(config.hideChat, enabled);
    const styleId = styleIds.hideChat;
    if (enabled) {
      GM_addStyle(
        `
                    #chat-v2, span.separator:nth-child(8), span.separator:nth-child(9) {
                        display: none;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleAddUserPrefix(enabled) {
    GM_setValue(config.addUserPrefix, enabled);
    const styleId = styleIds.addUserPrefix;
    if (enabled) {
      GM_addStyle(
        `
                    a.author:before {
                        content: "/u/";
                        text-transform: none!important;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleHideArchivedArrows(enabled) {
    GM_setValue(config.hideArchivedArrows, enabled);
    const styleId = styleIds.hideArchivedArrows;
    if (enabled) {
      GM_addStyle(
        `
                    .archived-infobar ~ #siteTable .arrow,
                    .archived-infobar ~ .commentarea .arrow {
                        visibility: hidden;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleOldCommentFont(enabled) {
    GM_setValue(config.oldCommentFont, enabled);
    const styleId = styleIds.oldCommentFont;
    if (enabled) {
      GM_addStyle(
        `
                    .md {
                        font-size: inherit;
                        line-height: normal;
                    }
                    .md p {
                        line-height: normal;
                    }
                    .md pre > code {
                        font-size: small;
                    }
                    .md h1 {
                        font-size: 1.2em;
                        line-height: normal;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleFullUserScores(enabled) {
    GM_setValue(config.fullUserScores, enabled);
    const styleId = styleIds.fullUserScores;
    if (enabled) {
      GM_addStyle(
        `
                    .link .score {
                        font-size: 0;
                    }
                    .link .score::before {
                        content: attr(title);
                        font-size: 12px;
                    }
                    .link .score::first-letter {
                        font-size: 12px;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleOldRedditIcons(enabled) {
    GM_setValue(config.oldRedditIcons, enabled);
    const styleId = styleIds.oldRedditIcons;
    if (enabled) {
      GM_addStyle(
        `
                    .thumbnail.self {
                        height: 50px;
                        background-image: url(https://www.redditstatic.com/sprite-reddit.ZDiVRxCXXWg.png);
                        background-position: 0px -491px;
                        background-repeat: no-repeat;
                    }
                    .thumbnail.default {
                        background-image: url(https://www.redditstatic.com/sprite-reddit.ZDiVRxCXXWg.png);
                        background-position: 0px -434px;
                        background-repeat: no-repeat;
                        height: 50px;
                    }
                    .thumbnail.image {
                        background-image: url(https://www.redditstatic.com/sprite-reddit.ZDiVRxCXXWg.png);
                        background-position: 0px -434px;
                        background-repeat: no-repeat;
                        height: 50px;
                    }
                    .thumbnail.nsfw {
                        background-image: url(https://www.redditstatic.com/sprite-reddit.ZDiVRxCXXWg.png);
                        background-position: 0px -361px;
                        background-repeat: no-repeat;
                        height: 69px;
                    }
                    .thumbnail.spoiler {
                        background-image: url(https://imgoat.com/uploads/679091c5a8/5031.png);
                        background-position: 0px -361px;
                        background-repeat: no-repeat;
                        height: 69px;
                    }
                    img.interstitial-image[src *= "interstitial-image-banned.png"]
                    {
                       content: url("https://files.catbox.moe/28n0bn.png");
                       width: auto !important;
                       height: auto !important;
                       max-width: 100%;
                       max-height: 100%;
                    }

                    img.interstitial-image[src *= "interstitial-image-over18.png"]
                    {
                       content: url("https://files.catbox.moe/4tglxx.png");
                       width: auto !important;
                       height: auto !important;
                       max-width: 100%;
                       max-height: 100%;
                    }
                    .gilded-gid2-icon:before {
                        width: 13px;
                        height: 13px;
                        background-position: -42px -1676px !important;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleExpandoButtons(enabled) {
    GM_setValue(config.expandoButtons, enabled);
    const styleId = styleIds.expandoButtons;
    if (enabled) {
      GM_addStyle(
        `
  .expando-button {
    background-image: url("//www.redditstatic.com/sprite-reddit.5kxTB7FXse0.png") !important;
  }
  .expando-button.selftext.collapsed,
  .expando-button.crosspost.collapsed {
    background-position: -29px -1442px;
  }
  .expando-button.selftext.collapsed:hover,
  .expando-button.crosspost.collapsed:hover {
    background-position: 0 -1442px;
  }
  .expando-button.selftext.expanded,
  .expando-button.crosspost.expanded {
    background-position: -87px -1442px;
  }
  .expando-button.selftext.expanded:hover,
  .expando-button.crosspost.expanded:hover {
    background-position: -58px -1442px;
  }
  .expando-button.image.collapsed,
  .expando-button.video.collapsed,
  .expando-button.video-muted.collapsed,
  .expando-button.gallery.collapsed {
    background-position: 0 -1471px;
  }
  .expando-button.image.collapsed:hover,
  .expando-button.video.collapsed:hover,
  .expando-button.video-muted.collapsed:hover,
  .expando-button.gallery.collapsed:hover {
    background-position: -116px -1442px;
  }
  .expando-button.image.expanded,
  .expando-button.video.expanded,
  .expando-button.video-muted.expanded,
  .expando-button.gallery.expanded {
    background-position: -58px -1471px;
  }
  .expando-button.image.expanded:hover,
  .expando-button.video.expanded:hover,
  .expando-button.video-muted.expanded:hover,
  .expando-button.gallery.expanded:hover {
    background-position: -29px -1471px;
  }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleClassicRESNight(enabled) {
    GM_setValue(config.classicRESNight, enabled);
    const styleId = styleIds.classicRESNight;
    if (enabled) {
      GM_addStyle(
        `
                    /* HEADER */
                    .res-nightmode div.entry:nth-child(1) > div:nth-child(1) {
                        margin-top: 10px;
                    }
                    .res-floater-visibleAfterScroll {
                        top: 5px !important;
                        z-index: 10000000000 !important;
                    }
                    .res-nightmode #sr-header-area, .res-nightmode #sr-more-link {
                        background-color: rgb(68, 68, 68) !important;
                        color: rgb(222, 222, 222) !important;
                    }
                    .res-nightmode #RESSubredditGroupDropdown a,
                    .res-nightmode #RESSubredditGroupDropdown > .RESShortcutsEditButtons .res-icon,
                    .res-nightmode .RESNotificationContent,
                    .res-nightmode .RESNotificationFooter,
                    .res-nightmode body .sr-bar a {
                        color: rgb(222, 222, 222);
                    }
                    .res-nightmode #header, .res-nightmode .liveupdate-home .content {
                        background-color: rgb(105, 105, 105);
                        border-bottom: 1px solid rgb(160, 160, 160) !important;
                    }
                    .res-nightmode body .tabmenu li.selected a {
                        color: orangered;
                        background-color: white;
                        border: 1px solid rgb(160, 160, 160);
                        border-bottom: 1px solid white;
                        border-bottom-color: rgb(34, 34, 34) !important;
                        z-index: 100;
                    }
                    .res-nightmode div#RESShortcutsEditContainer,
                    .res-nightmode div#RESShortcutsSort,
                    .res-nightmode div#RESShortcutsRight,
                    .res-nightmode div#RESShortcutsLeft,
                    .res-nightmode div#RESShortcutsAdd,
                    .res-nightmode div#RESShortcutsTrash {
                        background: rgb(68, 68, 68) !important;
                        color: rgb(140, 179, 217) !important;
                    }
                    .res-nightmode .pagename a {
                        color: black;
                    }
                    .res-nightmode body.with-listing-chooser #header .pagename {
                        position: inherit;
                    }
                    /* FRONTPAGE */
                    .res-nightmode .trending-subreddits {
                        background-color: rgb(54, 54, 54) !important;
                        margin-top: 0px !important;
                        margin-left: 0px !important;
                        margin-bottom: 4px !important;
                        padding-bottom: 1px !important;
                    }
                    .res-nightmode body,
                    .res-nightmode body .content,
                    .res-nightmode .modal-body,
                    .res-nightmode .side,
                    .res-nightmode .icon-menu a,
                    .res-nightmode .side .leavemoderator,
                    .res-nightmode .side .leavecontributor-button,
                    .res-nightmode .side .titlebox,
.res-nightmode .side .spacer .titlebox .redditname,
                    .res-nightmode .side .titlebox .flairtoggle,
                    .res-nightmode .side .usertext-body .md ol,
                    .res-nightmode .side .usertext-body .md ol ol,
                    .res-nightmode .side .usertext-body .md ol ol li,
                    .res-nightmode .modactionlisting table *,
                    .res-nightmode .side .recommend-box .rec-item,
                    .res-nightmode .side .md ul {
                        background-color: rgb(34, 34, 34) !important;
                    }
                    .res-nightmode .titlebox form.toggle, .leavemoderator {
                        background: rgb(34, 34, 34) none no-repeat scroll center left !important;
                    }
                    .res-nightmode .side .spacer {
                        margin: 7px 0 12px 5px !important;
                    }
                    .res-nightmode .content {
                        margin-left: 0px !important;
                        margin-top: 0px !important;
                    }
                    .res-nightmode body.with-listing-chooser.listing-chooser-collapsed>.content {
                        margin-left: 0px !important;
                    }
                    .res-nightmode body.with-listing-chooser.listing-chooser-collapsed .listing-chooser {
                        padding-right: 0px !important;
                    }
                    .res-nightmode body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy {
                        width: 0px !important;
                    }
                    .res-nightmode .content .spacer {
                        margin-bottom: 0px !important;
                    }
                    .res-nightmode .NERPageMarker {
                        background-color: rgb(24, 24, 24);
                        margin: 0px !important;
                    }
                    .res-nightmode .thing.odd.link {
                        padding: 7px !important;
                        margin: 0;
                        background-color: rgb(34, 34, 34);
                    }
                    .res-nightmode .thing.even.link {
                        background: rgb(24, 24, 24);
                        padding: 7px !important;
                        margin: 0;
                    }
                    .res-nightmode .midcol .score, .res-nightmode .moduleButton:not(.enabled) {
                        color: #c6c6c6 !important;
                    }
                    .res-nightmode .rank .star,
                    .res-nightmode .link .score.likes,
                    .res-nightmode .linkcompressed .score.likes {
                        color: rgb(255, 69, 0) !important;
                    }
                    .res-nightmode .rank .star,
                    .res-nightmode .link .score.dislikes,
                    .res-nightmode .linkcompressed .score.dislikes {
                        color: rgb(140, 179, 217) !important;
                    }
                    .res-nightmode .content {
                        border-color: rgb(17, 17, 17);
                    }
                    .res-nightmode .wiki-page .wiki-page-content .md.wiki > .toc ul,
                    .res-nightmode .tabmenu li a,
                    .res-nightmode .tabmenu li.selected a {
                        background-color: rgb(34, 34, 34) !important;
                    }
                    .res-nightmode .link .rank {
                        color: #c6c6c6 !important;
                    }
                    .res-nightmode .domain a {
color: rgb(173, 216, 230) !important;
                    }
                    .res-nightmode .subreddit {
                        color: rgba(20, 150, 220, 0.8) !important;
                    }
                    .res-nightmode .author {
                        color: rgba(20, 150, 220, 0.8) !important;
                    }
                    .res-nightmode .live-timestamp {
                        color: #B3B375 !important;
                    }
                    .res-nightmode .RES-keyNav-activeElement > .tagline,
                    .res-nightmode .RES-keyNav-activeElement .md-container > .md,
                    .res-nightmode .RES-keyNav-activeElement .md-container > .md p {
                        color: rgb(187, 187, 187) !important;
                    }
                    .res-nightmode .flair, .res-nightmode .linkflairlabel {
                        background-color: rgb(187, 187, 187);
                        color: rgb(0, 0, 0);
                        padding: 1px;
                    }
                    .res-nightmode:not(.res-nightMode-coloredLinks) .thing:not(.stickied) .title:visited,
                    .res-nightmode:not(.res-nightMode-coloredLinks) .thing.visited:not(.stickied) .title,
                    .res-nightmode:not(.res-nightMode-coloredLinks).combined-search-page .search-result a:visited,
                    .res-nightmode:not(.res-nightMode-coloredLinks).combined-search-page .search-result a:visited>mark {
                        color: rgb(120, 120, 120);
                    }
                    .res-nightmode .md,
                    .res-nightmode .content .sitetable .thing .md,.res-nightmode .RES-keyNav-activeElement .md-container > .mdp {
                        color: rgb(222, 222, 222) !important;
                    }
                    .res-nightmode .combined-search-page .search-result a {
                        color: rgb(222, 222, 222);
                    }
                    .res-nightmode .entry .buttons li a {
                        color: rgb(150, 150, 150) !important;
                    }
                    .res-nightmode #RESSubredditGroupDropdown,
                    #RESSubredditGroupDropdown > .RESShortcutsEditButtons {
                        background-color: rgb(68, 68, 68) !important;
                        border-color: rgb(128, 128, 128) !important;
                    }
                    .res-nightmode .spoiler-stamp {
                        color: #c76700 !important;
                    }
                    .res-nightmode .entry.res-selected,
                    .res-nightmode .entry.res-selected .md-container {
                        background-color: rgba(0, 0, 0, 0)!important;
                    }
                    /* BUTTONS */
                    .res-nightmode .thing .expando-button,
                    .res-nightmode .thing .expando-button:hover,
                    .res-nightmode .expando-button,
                    .res-nightmode .expando-button:hover {
                        background-image: url("https://s3.amazonaws.com/a.thumbs.redditmedia.com/PkckcN8_3ijRUVP-GUQ6E-c8Ash_jQ3kCrEAoqKjSC4.png") !important;
                        transform: scale(1);
                        -webkit-filter: grayscale(0%) invert(0%);
                        background-color: transparent;
                    }
                    .res-nightmode .expando-button.video-muted.collapsed {
                        background-position: 0px -384px !important;
                    }
                    .res-nightmode .expando-button.video-muted.collapsed:hover {
                        background-position: 0px -408px !important;
                    }
                    .res-nightmode .expando-button.video-muted.expanded {
                        background-position: 0px -432px !important;
                    }
                    .res-nightmode .expando-button.video-muted.expanded:hover {
                        background-position: 0px -456px !important;
                    }
                    .res-nightmode .expando-button.selftext.collapsed {
                        background-position: 0px -96px !important;
                    }
                    .res-nightmode .expando-button.selftext.collapsed:hover {
                        background-position: 0px -120px !important;
                    }
                    .res-nightmode .expando-button.selftext.expanded {
                        background-position: 0px -144px !important;
                    }
                    .res-nightmode .expando-button.selftext.expanded:hover {
                        background-position: 0px -168px !important;
                    }
                    .res-nightmode .expando-button.image.gallery.collapsed {
                        background-position: 0px -288px !important;
                    }
                    .res-nightmode .expando-button.image.gallery.collapsed:hover {
                        background-position: 0px -312px !important;
                    }
                    .res-nightmode .expando-button.image.gallery.expanded {
                        background-position: 0px -336px !important;
                    }
                    .res-nightmode .expando-button.image.gallery.expanded:hover {
                        background-position: 0px -360px !important;
                    }
                    .res-nightmode .expando-button.video.collapsed {
                        background-position: 0px -192px !important;
                    }
                    .res-nightmode .expando-button.video.collapsed:hover {
                        background-position: 0px -216px !important;
                    }
                    .res-nightmode .expando-button.video.expanded {
                        background-position: 0px -240px !important;
                    }
                    .res-nightmode .expando-button.video.expanded:hover {
                        background-position: 0px -264px !important;
                    }
                    .res-nightmode .expando-button.collapsed.crosspost {
                        background-position: 0px -96px !important;
                    }
                    .res-nightmode .expando-button.collapsed.crosspost:hover {
                        background-position: 0px -120px !important;
                    }
                    .res-nightmode .expando-button.expanded.crosspost {
                        background-position: 0px -144px !important;
                    }
                    .res-nightmode .expando-button.expanded.crosspost:hover {
                        background-position: 0px -168px !important;
                    }
                    .res-nightmode .expando-button.image.collapsed {
                        background-position: 0px 0px !important;
                    }
                    .res-nightmode .expando-button.image.collapsed:hover {
                        background-position: 0px -24px !important;
                    }
                    .res-nightmode .expando-button.image.expanded {
                        background-position: 0px -48px !important;
                    }
                    .res-nightmode .expando-button.image.expanded:hover {
                        background-position: 0px -72px !important;
                    }
                    /* COMMENTS */
                    .res-nightmode .res-commentBoxes .comment {
                        border-left-width: 0px !important;
                        border-right-width: 0px !important;
                        border-top-width: 0px !important;
                        border-bottom-width: 0px !important;
                    }
                    .res-nightmode .linkflairlabel, .res-nightmode .flair {
                        padding-top: 0px !important;
                        padding-left: 2px !important;
                        padding-right: 2px !important;
                    }
                    .res-nightmode.res-commentBoxes .comment,
                    .res-nightmode.res-commentBoxes .comment .comment .comment,
                    .res-nightmode.res-commentBoxes .comment .comment .comment .comment .comment,
                    .res-nightmode.res-commentBoxes .comment .comment .comment .comment .comment .comment .comment,
                    .res-nightmode.res-commentBoxes .comment .comment .comment .comment .comment .comment .comment .comment .comment {
                        background-color: rgb(24, 24, 24) !important;
                    }
                    .res-nightmode.res-commentBoxes body .comment .comment,
                    .res-nightmode.res-commentBoxes body .comment .comment .comment .comment,
                    .res-nightmode.res-commentBoxes body .comment .comment .comment .comment .comment .comment,
                    .res-nightmode.res-commentBoxes body .comment .comment .comment .comment .comment .comment .comment .comment,
                    .res-nightmode.res-commentBoxes body .comment .comment .comment .comment .comment .comment .comment .comment .comment .comment {
                        background-color: rgb(34, 34, 34) !important;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleSubmitUnderlay(enabled) {
    GM_setValue(config.enableSubmitUnderlay, enabled);
    const styleId = styleIds.submitUnderlay;
    if (enabled) {
      GM_addStyle(
        `
                    .submit-link-underlay {
                        margin-top: 5px;
                        padding: 5px;
                        background-color: transparent;
                        display: flex;
                        align-items: center;
                        font-family: verdana, sans-serif;
                        font-size: 11px;
                        color: dimgray;
                    }
                    .submit-link-underlay img {
                        max-width: 40px;
                        max-height: 40px;
                        margin-right: 5px;
                    }
                    .submit-link-underlay p {
                        margin: 0;
                    }
                `,
        { id: styleId }
      );

      let underlayAdded = false;
      function addUnderlay() {
        const submitLink = document.querySelector(".submit-link");
        if (submitLink && !underlayAdded) {
          const underlay = document.createElement("div");
          underlay.className = "submit-link-underlay";

          const image = document.createElement("img");
          image.src = "https://files.catbox.moe/4zv032.png";

          const textContainer = document.createElement("div");
          textContainer.innerHTML = `<p>to anything interesting: news article, blog entry, video, picture...</p>`;

          underlay.appendChild(image);
          underlay.appendChild(textContainer);
          submitLink.parentNode.insertBefore(underlay, submitLink.nextSibling);
          underlayAdded = true;
        }
      }
      addUnderlay();
      const targetNode = document.body;
      const config = { childList: true, subtree: true };
      const observer = new MutationObserver(function (mutationsList) {
        for (const mutation of mutationsList) {
          if (mutation.addedNodes.length && !underlayAdded) {
            addUnderlay();
          }
        }
      });
      observer.observe(targetNode, config);
    } else {
      document.getElementById(styleId)?.remove();
      const underlay = document.querySelector(".submit-link-underlay");
      if (underlay) {
        underlay.remove();
      }
    }
  }

  function toggleClassicResBorderHighlight(enabled) {
    GM_setValue(config.classicResBorderHighlight, enabled);
    const styleId = styleIds.classicResBorderHighlight;
    if (enabled) {
      GM_addStyle(
        `
                    .entry.res-selected {
                        border: dimgray 2px dotted;
                    }
                `,
        { id: styleId }
      );
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  function toggleDarkMode(enabled) {
    GM_setValue(config.darkMode, enabled);
    const styleId = styleIds.darkMode;
    if (enabled) {
      if (!document.getElementById(styleId)) {
        const style = document.createElement("style");
        style.id = styleId;
        style.textContent = `
          html,
          body,
          body .content,
          .modal-body,
          .side,
          .icon-menu a,
          .side .leavemoderator,
          .side .leavecontributor-button,
          .side .titlebox,
          .side .spacer .titlebox .redditname,
          .side .titlebox .flairtoggle,
          .side .usertext-body .md ol,
          .side .usertext-body .md ol ol,
          .side .usertext-body .md ol ol li,
          .modactionlisting table *,
          .side .recommend-box .rec-item,
          .crosspost-preview,
          .crosspost-thing-preview {
            background-color: #262626 !important;
            border-color: #777 !important;
          }

          /* Created by /u/PersonalPi @ Reddit */
          /* Version 1.12 */

          /************** CONFIGURATION **************/
          /* Chat is disabled by default. */
          /* (UNTESTED) Comment out to enable chat (UNTESTED). */
          #chat,
          a[target="chat-app"],
          img[src="//www.redditstatic.com/start_chat.png"],
          #header-bottom-right>span:nth-child(4) {
            display: none !important;
          }

          /* This disables the tooltip when you hover your mouse over an author for a post. */
          /* Comment out to enable the tooltip. */
          .author-tooltip {
            display: none !important;
          }

          /* This disables the large pane that shows on the top of the search page. */
          /* Uncomment to show the pane. */
          .searchpane {
            /* display: none !important; */
          }

          /* This will remove the domain part next to the title, such as (i.imgur.com). */
          /* Uncomment to hide domains. */
          .domain {
            /* display: none !important; */
          }

          /* This will display a red line (or any color you want using the "background:" property) */
          /* between parent comments. */
          /* Comment out to disable the line */
          .nestedlisting>.comment+.clearleft {
            height: 2px !important;
            margin-bottom: 5px !important;
            background: #8b0000 !important;
          }

          /* This will display a border around comments.
             * Adjust the color to whatever you want using border-color.
             * Comment out to disable. */
          .comment:hover {
            border-color: #555 !important;
          }

          /* This controls the header section that displays your username,
           * karma, inbox, preferences, and logout. By default it is on top.
           * To move it to the bottom, comment out this section */
          #header-bottom-right {
            font: normal x-small verdana, arial, helvetica, sans-serif !important;
            color: rgb(204, 204, 204) !important;
            margin: 0 !important;
            position: absolute !important;
            right: 0px !important;
            padding: 4px !important;
            line-height: 12px !important;
            background-color: rgb(51, 51, 51) !important;
            top: 19px !important;
            bottom: auto !important;
            border-radius: 0px 0px 0px 3px !important;
            display: block !important;
          }

          /************** END CONFIGURATION **************/

          /* Remove annoying stuff */
          div.giftgold,
          #redesign-beta-optin-btn,
          .initialized,
          .listing-chooser li.selected,
          .grippy:after,
          body>div.side>div:nth-child(5)>div>.spacer,
          .give-gold-button,
          .quarantine-stamp,
          div.nub,
          a[class="premium-banner-outer"],
          div[class="quarantine-notice"],
          div.sidebox.create>div.spacer {
            display: none !important;
          }

          /* Upvote/Downvote Arrows */
          .arrow.up, .arrow.upmod, .arrow.down, .arrow.downmod {
            background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAcCAMAAADC4sagAAABFFBMVEUjJCQiIiIjIyMkIiIkJCQlJSUlJicmJiYnIyEnJycnKCsoKCgpLC8rIyErKyssMDUvLy8wJCAwMDAxMTEyMjI0NDQ2NjY3JR83Nzc5OTk7Ozs8PDw9PT0+Pj4/Pz9AQEBBQUFCQkJDQ0NGRkZISEhKSkpKV2tLS0tMTExOTk5PT09QYHdSUlJTU1NVVVVWVlZXV1dXaINYWFhaWlpabYlbW1tecpBgYGBhYWFid5dkZGRle5xlfJ1pgKRrhKhshKlshapuLhZwirFyjbV0j7h4lL97mcZ9MBR/nsyCo9OOMxGcNQ+eNg+kNw6sOA2vOAy0OQy7Ogq/OwrBOwrDPAnLPQjPPQfTPgfbPwXjQQTrQgPzQwLKxGgxAAAAAXRSTlMAQObYZgAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlJREFUOMu9lF1TwjAQRTcMvmeQOi1QPmxFBQTxW1ERUUFEUVRU/P//w9yGmBTFyZPnpXNmbju76W6IJM8Uw49rLa6Tz4mpq/mCqY3Gvqnj6XQ61lp0mGd8favCwx2tow8wUlpwGWOZrNJKjXO+UVc6fJcMZzV7IswSOU/qej0l0rwyq33wphhAM1kWkcy70GB7mUfUNqG9V02PyPMTMs2Wig5RaTctwzxVXyPqvJh0VkJBIKJ4huncCRAvHOEZyGKegO4a6UDrIdLGCT4C6/QDsE7fA+v0HdAadWqk0SH9D3sgXkm4uJIDYKTFnwwXd3kMrNOnwDp9BmzS5QuTshN1iDRwfkxV9VJTJXLzSWYM+NzEEjWvFE2oGvCE7/2yDeL8riWzM8xmorRazLlNI2rdgNb3ZYLF1Es/t8VE7X6/39Yqlt4tLLwhiLq3XVNLfumP24fo3Opm+wLGCVa252Y8tQAAAABJRU5ErkJggg==') !important;
            background-repeat: no-repeat !important;
          }

          .embedded-page .content>.sitetable,
          .embedded-page.helpcenter-page .content,
          .embedded-page.compose-page .content,
          .embedded-page .content>.sitetable>div:nth-of-type(4n + 1),
          .embedded-page.helpcenter-page .content>div:nth-of-type(4n + 1),
          .embedded-page.compose-page .content>div:nth-of-type(4n + 1) {
            background-color: #262626 !important;
            color: #aaa !important;
          }

          .link,
          .helpcenter-form .section-content {
            background-color: #262626 !important;
          }

          .helpcenter-form .helpcenter-bottom-panel .helpcenter-content-policy p {
            color: #aaa !important;
          }

          .popup,
          .guider,
          .guider p {
            background-color: #262626 !important;
            color: #aaa !important;
          }

          #login_login {
            background-color: #333333 !important;
            color: #bbb !important;
          }

          .message.new>.entry,
          .read-next,
          .drop-choices {
            border-color: #4d4d4d !important;
            background-color: #333333 !important;
          }

          .drop-choices {
            box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.3) !important;
          }

          .read-next .read-next-header,
          .flairselector h2,
          .flairselector li:hover {
            border-color: transparent !important;
            background-color: #3e3e3e !important;
          }

          .flairselector li.selected {
            border-color: #787878 !important;
          }

          .liveupdate-app .content {
            background-color: #161616 !important;
          }

          .entry .morecomments .gray,
          .markdownEditor {
            color: rgba(221, 221, 221, 0.8) !important;
          }

          .trophy-info .trophy-name {
            color: #eee !important;
          }

          .sidecontentbox .content {
            border-color: rgba(234, 234, 234, 0.1) !important;
          }

          #progressIndicator,
          .hover-bubble,
          .side .side-message,
          #editShortcutDialog {
            color: #ddd !important;
            border-color: #4d4d4d !important;
            background-color: #333333 !important;
          }

          .login-form-side {
            background-color: #888 !important;
            color: #eee !important;
          }

          .login-form-side .error {
            color: #cd5a5a !important;
          }

          #header,
          .liveupdate-home .content {
            background-color: dimgray !important;
          }

          #jumpToContent {
            color: #ddd !important;
            border: 1px solid !important;
            padding: 0 2px !important;
          }

          #sr-header-area,
          #sr-more-link {
            background-color: #ccc !important;
            color: #000 !important;
          }

          .usertable tr .user .userkarma {
            color: #aa9 !important;
          }

          .thing.spam {
            background-color: #3d2929 !important;
          }

          .content .pretty-form * {
            box-shadow: none !important;
          }

          .new-comment .usertext-body {
            border-color: #242b3f !important;
            background-color: #1a2135 !important;
          }

          .wiki-page .pageactions .wikiaction-current {
            background-color: #777 !important;
          }

          .contact-us-page .button {
            background: #777 !important;
            color: #ddd !important;
          }

          .contact-us-page .button:hover {
            background: #666 !important;
          }

          .message .subject .correspondent {
            background: #212f46 !important;
            color: #1496dc !important;
          }

          .moderator .linefield {
            background: #1a1a1a !important;
          }

          .wiki-page .wiki-page-content .md.wiki>.toc ul,
          .tabmenu li a,
          .tabmenu li.selected a,
          #report form {
            background-color: #262626 !important;
          }

          .tabmenu li.selected a {
            color: #d25a32 !important;
            border-bottom-color: #262626 !important;
          }

          .tabmenu.formtab a {
            color: white !important;
            border-color: #505050 !important;
          }

          .tabmenu.formtab .selected a {
            color: white !important;
            background-color: #5f99cf !important;
          }

          .side .titlebox form.flairtoggle,
          .trophy-area .content,
          .side .md ol,
          .side .md ul {
            background-color: #262626 !important;
            color: #ddd !important;
          }

          .organic-listing {
            border-color: #505050 !important;
            background-color: transparent !important;
          }

          .organic-listing .nextprev {
            opacity: 0.5 !important;
          }

          .organic-listing .link,
          .link.promotedlink {
            background-color: transparent !important;
            border-color: #505050 !important;
          }

          .arrow.up {
            background-position: -15px 0 !important;
          }

          .arrow.up:hover {
            background-position: -30px 0 !important;
          }

          .arrow.upmod {
            background-position: 0 0 !important;
          }

          .arrow.down {
            background-position: -15px -14px !important;
          }

          .arrow.down:hover {
            background-position: -30px -14px !important;
          }

          .arrow.downmod {
            background-position: 0 -14px !important;
          }

          .subredditbox li {
            font-weight: 700 !important;
            text-transform: lowercase !important;
          }

          .subredditbox li a::before {
            content: "#" !important;
          }

          .dropdown.lightdrop a.choice:hover {
            background-color: #1a1a1a !important;
          }

          .sidebox,
          .subreddit-info,
          .raisedbox,
          .login-form-side,
          .interstitial-subreddit-description {
            background-color: #393939 !important;
            border-color: #151515 !important;
            color: #aaa !important;
          }

          .subreddit-info .spacer a {
            background-color: #262626 !important;
          }

          .morelink {
            background: #444 !important;
            border-color: #444 !important;
          }

          .morelink:hover {
            border-color: #333333 !important;
            background: #333333 !important;
          }

          .morelink:hover a {
            color: #1496dc !important;
          }

          .morelink .nub {
            display: none !important;
          }

          .sidebox .spacer,
          .side .linkinfo {
            background-color: #393939 !important;
          }

          .commentbody.border {
            background-color: #369 !important;
          }

          input[type="number"],
          input[type="text"],
          input[type="password"],
          .c-form-control {
            color: #ccc !important;
            border: 1px solid #4d4d4d !important;
            background-color: #333333 !important;
          }

          .content textarea {
            background-color: #333333 !important;
            color: #eee !important;
          }

          .rulespage .example,
          #userTaggerTable th,
          #newCommentsTable th,
          .instructions .preftable th,
          .instructions .pretty-form,
          .remove-self .option,
          .unfriend-button .option,
          .entry .buttons li.reported-stamp,
          .pretty-button,
          .report-reasons {
            color: #000 !important;
          }

          .viewSource textarea[readonly] {
            background: #666666 !important;
          }

          .reported {
            border-color: #daa520 !important;
          }

          .nextprev a {
            background: #777 !important;
            border-color: #333333 !important;
            color: #ddd !important;
          }

          .nextprev img:hover {
            opacity: 0.85 !important;
          }

          #ad-frame {
            opacity: 0.8 !important;
          }

          .comment.unread {
            background-color: #4a473b !important;
          }

          .raisedbox .flat-list a {
            background-color: #262626 !important;
          }

          .raisedbox .flat-list a:hover {
            background-color: #369 !important;
            color: #fff !important;
          }

          .instructions {
            background: #fff !important;
          }

          #siteTable .link .title.loggedin.click,
          #BigEditor .markdownEditor a {
            color: gray !important;
          }

          .markhelp.md tr td {
            background-color: #36c !important;
          }

          .mail .havemail img,
          .mail .nohavemail img {
            visibility: hidden !important;
          }

          .expando-button {
            background-color: transparent !important;
          }

          #sr-autocomplete-area {
            z-index: 1 !important;
          }

          button,
          input[type="button"],
          input[type="submit"],
          input[type="reset"] {
            color: #fff !important;
            border: 1px outset gray !important;
            background-color: #4d4d4d !important;
          }

          .create-reddit .title {
            background-color: rgba(24, 24, 24, 0.2) !important;
            color: #8ad !important;
          }

          .linefield .linefield-content {
            border-color: #1a1a1a !important;
          }

          .content .roundfield,
          .content.submit .roundfield,
          .traffic-table tr:nth-of-type(even) {
            background-color: #181818 !important;
          }

          .traffic-table tr:nth-of-type(odd).promo-traffic-live {
            color: #181818 !important;
          }

          .traffic-table.promocampaign-table tr.active {
            background-color: #6d2f39 !important;
            border: 2px dotted #a70000 !important;
          }

          .sponsored-page .dashboard {
            color: #dedede !important;
          }

          .sponsored-page .campaign-editor .editor-group,
          .sponsored-page .editor-group {
            background-color: #151515 !important;
          }

          .sponsored-page .campaign-editor .campaign-set {
            background-color: #666 !important;
          }

          .sponsored-page .linefield-content textarea,
          .sponsored-page .linefield-content input {
            color: #181818 !important;
          }

          .linefield .markhelp table {
            background-color: inherit !important;
          }

          .content .sponsored-page textarea,
          .content .sponsored-page input {
            background-color: #fcfcfc !important;
          }

          .md code,
          .md pre,
          .link .md pre,
          .content .md pre,
          .new-comment .md pre,
          .usertext.border .md pre,
          .link .md :not(pre)>code,
          .new-comment .md :not(pre)>code,
          .usertext.border .md :not(pre)>code {
            color: inherit !important;
            border-color: #58697b !important;
            background-color: #2a3340 !important;
          }

          .comment .md p a[href="/spoiler"],
          .comment .md p a[href="#spoiler"] {
            background-color: #000 !important;
            color: #000 !important;
          }

          .usertable tr:hover,
          .moderator-table tr:hover,
          .usertext.border .usertext-body,
          .usertext.grayed .usertext-body {
            background-color: #444 !important;
          }

          .login-form,
          .login-form-side .submit,
          #header-bottom-right,
          #srList,
          .dropdown.lightdrop .drop-choices {
            background-color: #333333 !important;
          }

          #srList tr {
            border-bottom-color: #646464 !important;
          }

          #srList tr:hover {
            background-color: #3e3e3e !important;
          }

          #quickMessage textarea,
          #quickMessage select {
            background-color: #aaa !important;
          }

          #search input[type="text"] {
            color: white !important;
          }

          #search select,
          #search option {
            color: #1a1a1a !important;
          }

          a,
          .md a,
          .share-button .option,
          #subscribe a,
          .share .option,
          .wired a,
          .side a,
          .link .score.dislikes,
          .linkcompressed .score.dislikes,
          a[rel="tag"],
          .dsq-help,
          #authorInfoToolTip h3 a,
          .reddiquette,
          .parent .author,
          .parent .subreddit,
          .combined-search-page .search-result a,
          .combined-search-page .search-result a>mark,
          .hoverHelp,
          .deepthread a,
          .policy-page .md h1 a,
          .policy-page .md h3 a,
          .side h1 a,
          .side h2 a,
          .side h3 a,
          .side h4 a,
          .side h5 a,
          .side h6 a {
            color: #8cb3d9 !important;
          }

          .flairselector li a {
            color: #85b3e0 !important;
          }

          .thing .title {
            color: #dedede !important;
          }

          coloredLinks .thing .title {
            color: #5c99d6 !important;
          }

          .thing .source-url {
            color: #cccccc !important;
          }

          coloredLinks .thing .source-url {
            color: #3380cc !important;
          }

          .tagline a {
            color: #6a98af !important;
          }

          .morecomments a {
            color: #999999 !important;
          }

          .thing .title:visited,
          .thing.visited .title,
          .combined-search-page .search-result.visited a,
          .combined-search-page .search-result a:visited,
          .combined-search-page .search-result a:visited>mark {
            color: #a6a6a6 !important;
          }

          coloredLinks .thing .title:visited,
          coloredLinks .thing.visited .title,
          coloredLinks .combined-search-page .search-result.visited a,
          coloredLinks .combined-search-page .search-result a:visited,
          coloredLinks .combined-search-page .search-result a:visited>mark {
            color: #a679d2 !important;
          }

          .thing .source-url:visited {
            color: #999999 !important;
          }

          coloredLinks .thing .source-url:visited {
            color: #945ec9 !important;
          }

          .flair-settings~.tabpane-content {
            border-color: #1a1a1a !important;
          }

          .flaircell input[type="text"] {
            border: 1px solid #555 !important;
          }

          .md blockquote {
            color: #a0a0a0 !important;
            border-left-color: #646464 !important;
          }

          .infobar:not(.newsletterbar),
          .reddit-infobar {
            border-color: #2966a3 !important;
            background-color: #264d73 !important;
          }

          .infobar:not(.newsletterbar) .md,
          .reddit-infobar .md {
            color: white !important;
          }

          .rank .star,
          .link .score.likes,
          .linkcompressed .score.likes {
            color: #ff4500 !important;
          }

          .linkcompressed .entry .buttons li a,
          .link .usertext-body .md,
          .thing .compressed,
          .link.promotedlink,
          .link.promotedlink.promoted,
          .subreddit .usertext .md,
          .commentreply .help tr {
            background: none !important;
          }

          .link .usertext-body .md,
          .side .linkinfo {
            border-color: #666 !important;
          }

          .subreddit-info .label,
          .sidebox .subtitle,
          .modactionlisting .description,
          .modactionlisting .timestamp time,
          .modactionlisting .timestamp {
            color: #aaa !important;
          }

          .submit textarea,
          .submit #url,
          .submit #sr-autocomplete,
          .usertext-edit textarea,
          .c-close,
          #liveupdate-statusbar,
          #liveupdate-statusbar.complete,
          #alert_message input {
            color: #ccc !important;
            border-color: #4d4d4d !important;
            background-color: #333333 !important;
          }

          #liveupdate-statusbar.live.connected {
            background-color: #344b4e !important;
            border: 1px solid #38585f !important;
            color: inherit !important;
          }

          .comment,
          .comment .comment .comment,
          .comment .comment .comment .comment .comment,
          .comment .comment .comment .comment .comment .comment .comment,
          .comment .comment .comment .comment .comment .comment .comment .comment .comment {
            background-color: #161616 !important;
          }

          .comment .comment,
          .comment .comment .comment .comment,
          .comment .comment .comment .comment .comment .comment,
          .comment .comment .comment .comment .comment .comment .comment .comment,
          .comment .comment .comment .comment .comment .comment .comment .comment .comment .comment {
            background-color: #121212 !important;
          }

          .comment {
            border-color: #333333 !important;
          }

          .comment.spam {
            background-image: linear-gradient(#633636, #633636) !important;
          }

          .side .age,
          .trophy-info *,
          .golddvertisement,
          .flair-jump .title,
          .savedComment,
          .md,
          .md h2,
          .content .sitetable .thing .md,
          .side .usertext-body ol,
          .side .redditname a,
          .side h1 *,
          .side h2 *,
          .side h3 *,
          .side h4 *,
          .side h5 *,
          .side h6 *,
          .content .wiki-page-content .md.wiki h1,
          .content .wiki-page-content .md.wiki h2,
          .content .wiki-page-content .md.wiki h3,
          .content .wiki-page-content .md.wiki h4,
          .content .wiki-page-content .md.wiki h5,
          .content .wiki-page-content .md.wiki h6,
          .content .wiki-page-content .md.wiki p,
          .wiki-page .wiki-page-content .pagelisting,
          .sidebar h1,
          .sidebar h2,
          .sidebar h3,
          .sidebar h4,
          .sidebar h5,
          .sidebar h6,
          .flairselector h2,
          .wiki-page .wiki-page-content .description h2 {
            color: #ddd !important;
          }

          .voteWeight,
          .nextprev img {
            opacity: 0.7 !important;
          }

          .searchfacets {
            background-color: #2c2c2c !important;
            box-shadow: none !important;
          }

          .combined-search-page .search-result .search-result-body,
          .generic-table,
          .message.message-reply.recipient>.entry .head,
          .message.message-parent.recipient>.entry .head,
          .linefield .title,
          .liveupdate-listing li.liveupdate:hover time,
          .spam .domain,
          .spam .domain a,
          .hover-bubble.multi-selector strong,
          .subreddit-rules-page .md-container .md .subreddit-rule-description {
            color: inherit !important;
          }

          .comment.spam>.child,
          .message.spam>.child {
            background-color: transparent !important;
          }

          .nextprev a:hover,
          .next-suggestions a:hover {
            border-color: transparent !important;
            background-color: #777 !important;
          }

          .modactionlisting+#progressIndicator {
            width: auto !important;
            margin: 20px 310px 0 0 !important;
          }

          body.with-listing-chooser .listing-chooser,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser {
            background-color: #262626 !important;
          }

          body.with-listing-chooser .listing-chooser .grippy,
          body.with-listing-chooser .listing-chooser.initialized .grippy,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser.initialized .grippy {
            background-color: #262626 !important;
            border: none !important;
            outline: none !important;
          }

          body.with-listing-chooser .listing-chooser .grippy::after,
          body.with-listing-chooser .listing-chooser.initialized .grippy::after,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy::after,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser.initialized .grippy::after {
            background-color: #2f2f2f !important;
            border-right-color: #444 !important;
          }

          body.with-listing-chooser .listing-chooser .grippy:hover,
          body.with-listing-chooser .listing-chooser.initialized .grippy:hover,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy:hover,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser.initialized .grippy:hover {
            background-color: #262626 !important;
            border-left-color: #333333 !important;
          }

          body.with-listing-chooser .listing-chooser .grippy:hover::before,
          body.with-listing-chooser .listing-chooser.initialized .grippy:hover::before,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy:hover::before,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser.initialized .grippy:hover::before {
            background-color: #262626 !important;
          }

          body.with-listing-chooser .listing-chooser .grippy:hover::after,
          body.with-listing-chooser .listing-chooser.initialized .grippy:hover::after,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser .grippy:hover::after,
          body.with-listing-chooser.listing-chooser-collapsed .listing-chooser.initialized .grippy:hover::after {
            border-right-color: #777 !important;
          }

          .listing-chooser li,
          .listing-chooser li.selected {
            background-color: #393939 !important;
            color: #ccc !important;
            border-color: #000 !important;
            box-shadow: none !important;
          }

          .listing-chooser li a,
          .listing-chooser li.selected a {
            color: #8ad !important;
          }

          .listing-chooser .intro {
            background-color: #444 !important;
            border-color: #262626 !important;
            color: #ccc !important;
          }

          .listing-chooser .create button {
            color: #eee !important;
            background-color: #777 !important;
          }

          .subreddits .remove-sr,
          .add-sr .add {
            filter: invert(80%) !important;
          }

          #about-main #history .events.timeline .event:hover .event-content {
            box-shadow: 1px 0 3px 2px #aaa !important;
          }

          #about-main .statsgrid .stat .value {
            text-shadow: 0 3px 5px #1a1a1a !important;
          }

          .about-page .abouttitle h1,
          .create .morelink,
          .permission-summary,
          .flairselector li,
          .subreddit .usertext .md {
            border-color: transparent !important;
          }

          .about-page .about-menu {
            background: #ddd !important;
          }

          .about-page h2,
          .md del {
            color: #777 !important;
          }

          .about-page .about-menu li.selected a,
          .about-page .about-menu li:hover a,
          #about-main #history .events.timeline .event-content {
            background: #aaa !important;
          }

          .policy-page .md p {
            color: #eee !important;
          }

          .policy-page .md p em {
            background-color: #dad0b3 !important;
            color: #000 !important;
          }

          body,
          .sidebar .md,
          .side,
          .side *,
          .side .spacer,
          .content,
          .traffic-tables .traffic-table tr,
          .parentComment .md,
          .post-body.entry-content,
          .dsq-auth-header,
          .instructions .preftable th,
          #alert_message,
          #report-action-form {
            color: #ccc !important;
          }

          .titlebox form.toggle,
          .leavemoderator {
            background-color: inherit !important;
          }

          .server-seconds {
            background: #333333 !important;
            border-color: #1a1a1a !important;
          }

          .snoovatar-page footer .inputs,
          .guider,
          aside.sidebar #discussions li {
            background: #262626 !important;
          }

          .snoovatar-page .checkbox-label [type="checkbox"]+.proxy-checkbox {
            background: #f00 !important;
          }

          .snoovatar-page .checkbox-label [type="checkbox"]:checked+.proxy-checkbox {
            background: #0a802e !important;
          }

          .tagline .friend {
            color: #d25a32 !important;
          }

          .tagline .submitter {
            color: #00aaff !important;
          }

          .tagline .moderator {
            color: #228822 !important;
          }

          .tagline .admin,
          .user-distinction .admin {
            color: #c81414 !important;
          }

          hr,
          .md hr,
          .message.gold-auto blockquote {
            border-color: #3c3c3c !important;
            background-color: #3c3c3c !important;
          }

          .goldvertisement,
          .goldvertisement .inner {
            border-color: rgba(196, 180, 135, 0.5) !important;
          }

          .goldvertisement .inner h2,
          .goldvertisement .progress p {
            color: #c4b487 !important;
          }

          .goldvertisement a,
          .goldvertisement a:hover {
            background-color: #4d4d4d !important;
            border-color: black !important;
            color: white !important;
          }

          .letter-body p,
          #gold-letter h1,
          #about-gold h1,
          #about-gold footer>p,
          .remove-self .option,
          .moderator.remove-self .option,
          .message-count,
          .usertable>.toggle {
            color: #262626 !important;
          }

          .gold-accent {
            color: #e6daae !important;
            background-color: #837854 !important;
            border-color: #ac9c68 !important;
          }

          .side .gold-accent *,
          .gold-accent .details,
          .gold-accent h1,
          .gold-accent th {
            color: #e6daae !important;
          }

          .hover-bubble.anchor-top-centered::after,
          #about-main #history .events.timeline .event-marker.top,
          #about-main #history .events.timeline .event-marker.bottom {
            border-bottom-color: #aaa !important;
          }

          .guiders_arrow {
            opacity: 0.5 !important;
          }

          .white-field,
          .delete-field,
          .moderator .traffic-table tbody tr:nth-child(even),
          .instructions,
          .linefield .delete-field,
          #pref-delete .delete-field,
          .contact-us-page .details li,
          .subreddit-report-form input:disabled,
          .action-form input:disabled {
            background-color: transparent !important;
          }

          .message.message-reply .entry,
          .message.message-parent .entry,
          .flairselector.drop-choices.active,
          .message.threaded .child,
          .comment .child,
          .comment .showreplies,
          .message.message-reply:not(.threaded) .entry,
          .message.message-parent:not(.threaded) .entry,
          .liveupdate-app .content,
          .liveupdate-listing li.separator::before,
          .md td,
          .md th,
          .footer,
          .footer .col,
          .userTagLink.hasTag,
          #userTaggerPreview {
            border-color: #4d4d4d !important;
          }

          .comment .md p a[href="/spoiler"]:hover,
          .comment .md p a[href="/spoiler"]:active,
          .comment .md p a[href="#spoiler"]:hover,
          .comment .md p a[href="#spoiler"]:active,
          .addNewWidget,
          .editWidget,
          #authorInfoToolTip .option,
          .updateTime,
          #shortlink-text,
          .guiders_button,
          .blueButton,
          .gold-accent a,
          .snoovatar-page .gold-accent a,
          .combined-search-page .search-result-subreddit .search-subscribe-button .add.active,
          .combined-search-page .search-result-subreddit .search-subscribe-button .remove.active,
          .fancy-toggle-button a,
          .fancy-toggle-button .multi-count {
            color: white !important;
          }

          .markhelp table tr:first-child {
            background-color: #4d4d4d !important;
          }

          .usertext .markhelp .spaces,
          .liveupdate-listing li.separator time,
          .diff_header,
          .diff_next,
          .hover-bubble.multi-selector label:hover {
            background-color: #4d4d4d !important;
          }

          .flair,
          .linkflairlabel {
            color: #c8c8c8 !important;
            background-color: #404040 !important;
            border-color: #4d4d4d !important;
          }

          .flairrichtext[style*="color"] {
            color: #c8c8c8 !important;
            background-color: #404040 !important;
            border-color: #4d4d4d !important;
          }

          #modalOverlay.fadeIn {
            background-color: rgba(0, 0, 0, 0.7) !important;
          }

          #moduleOptionsScrim {
            background-color: rgba(34, 34, 34, 0.7) !important;
          }

          .optionsTable th {
            background-color: #3c3c3c !important;
          }

          .optionsTable tr:nth-child(2n) {
            background-color: #1d1d1d !important;
          }

          #moduleOptionsSaveStatus {
            background-color: #323232 !important;
            color: #969696 !important;
          }

          .toggleButton .toggleOff,
          .toggleButton .toggleOn,
          .toggleButton.reverseToggleButton:not(.enabled) .toggleOff,
          .toggleButton.reverseToggleButton:not(.enabled) .toggleOn {
            color: rgba(255, 255, 255, 0.8) !important;
            border-color: #3c3c3c !important;
          }

          .toggleButton:not(.enabled) .toggleOn,
          .toggleButton.enabled .toggleOff,
          .toggleButton.reverseToggleButton.enabled .toggleOn,
          .toggleButton.reverseToggleButton:not(.enabled) .toggleOff {
            color: #3c3c3c !important;
            border-color: #3c3c3c !important;
            background: #282828 !important;
          }

          .toggleButton.enabled .toggleOn,
          .toggleButton.reverseToggleButton:not(.enabled) .toggleOn {
            background: linear-gradient(to right, #25456b, #282828) !important;
          }

          .toggleButton:not(.enabled) .toggleOff,
          .toggleButton.reverseToggleButton.enabled .toggleOff {
            background: linear-gradient(to left, #882626, #282828) !important;
          }

          .link .rank {
            color: #505050 !important;
          }

          .midcol .score,
          .moduleButton:not(.enabled) {
            color: #646464 !important;
          }

          .tagline,
          .entry .buttons li a,
          .trending-subreddits strong {
            color: #828282 !important;
          }

          .nsfw-stamp {
            color: #bf4040 !important;
          }

          .spoiler-stamp {
            color: #ff8200 !important;
          }

          .diff_sub {
            background-color: rgba(240, 128, 128, 0.5) !important;
          }

          .diff_add {
            background-color: rgba(144, 238, 144, 0.4) !important;
          }

          .diff_chg {
            background-color: rgba(255, 255, 0, 0.4) !important;
          }

          .hover-bubble.multi-selector .create-multi input[type="text"] {
            color: #c04e51 !important;
            background-color: inherit !important;
          }

          #alert_message,
          #report-action-form {
            border-color: #404040 !important;
            background-color: #262626 !important;
          }

          .sr-interest-bar {
            border-color: transparent !important;
            background-color: #29333d !important;
          }

          .sr-interest-bar .bubble {
            background-color: black !important;
          }

          .sr-interest-bar .bubble::after {
            border-right-color: black !important;
          }

          .subreddit-rule-item:hover {
            background-color: #2b2b2b !important;
          }

          #keyHelp {
            border-color: #999 !important;
            background-color: #aaa !important;
            color: #333 !important;
          }

          #keyHelp td {
            border-color: #999 !important;
          }

          .subreddit .usertext .md {
            background-color: #333333 !important;
            border-color: #777 !important;
          }

          .user-subreddit .path {
            color: #8cb3d9 !important;
          }

          .modal .modal-header-title {
            color: #aaa !important;
          }

          .modal .modal-header,
          .modal .field-otp,
          .modal .modal-content {
            background-color: #333333 !important;
            border-color: #777 !important;
            color: #aaa !important;
          }

          .modal .c-close {
            background-color: inherit !important;
            filter: invert(100%) !important;
          }

          .report-modal .report-form-bottom-panel .report-form-content-policy a,
          .report-modal .report-form-action-desc {
            color: #8cb3d9 !important;
          }

          .report-modal .report-form-bottom-panel .report-form-content-policy p,
          .report-modal .report-reason-item .report-reason-display,
          .report-modal .report-form-last-step-text,
          .report-modal .report-form-last-step-text-custom-rules,
          .report-modal .report-form-big-content-policy {
            color: #aaa !important;
          }

          .report-modal .c-close {
            background-color: inherit !important;
          }

          .report-modal .report-form-block-user img,
          .report-modal .report-form-blocked-user img {
            filter: invert(100%) !important;
          }

          .crossposting-modal .crosspost-header-title,
          .crossposting-modal .crosspost-label,
          .crossposting-modal .crosspost-sublabel {
            color: #aaa !important;
          }

          .crossposting-modal .crosspost-description {
            background-color: #333333 !important;
            border-color: #777 !important;
          }

          .crossposting-modal .modal-body,
          .crossposting-modal .modal-content,
          .crossposting-modal .crosspost-field,
          .crossposting-modal .crosspost-preview,
          .crossposting-modal .crosspost-thing-preview {
            background-color: #262626 !important;
            color: #aaa !important;
          }

          .tfa-login-modal .tfa-login-caption {
            color: #aaa !important;
          }

          .tfa-login-modal .tfa-switch-type-of-code {
            color: #8cb3d9 !important;
          }

          .tfa-login-modal .tfa-login-bottom-panel .tfa-login-having-trouble a {
            color: #8cb3d9 !important;
          }

          .enable-tfa-modal .enable-tfa-caption,
          .enable-tfa-modal .pref-otp-qr li {
            color: #aaa !important;
          }

          .enable-tfa-modal .otp-secret-info canvas {
            border: solid 5mm white !important;
          }

          .enable-tfa-modal .switch-barcode-and-code {
            color: #8cb3d9 !important;
          }

          .enable-tfa-modal .enable-tfa-bottom-panel .enable-tfa-learn-more a,
          .enable-tfa-modal .enable-tfa-bottom-panel .switch-barcode-and-code a {
            color: #8cb3d9 !important;
          }

          .disable-tfa-modal .disable-tfa-caption {
            color: #aaa !important;
          }

          .disable-tfa-modal .disable-tfa-bottom-panel .disable-tfa-learn-more a {
            color: #8cb3d9 !important;
          }

          .backup-codes-modal .backup-codes-caption {
            color: #aaa !important;
          }

          .pinnable-content.pinned {
            background-color: #262626 !important;
          }

          .pinnable-content.pinned .c-close {
            background-color: dimgray !important;
          }

          .author-tooltip__head {
            background-color: #262626 !important;
            border-color: #777 !important;
          }

          .author-tooltip__credentials-list strong,
          .author-tooltip__head h3,
          .author-tooltip__description {
            color: #aaa !important;
          }

          .author-tooltip__link-list a,
          .author-tooltip__head a {
            color: #8cb3d9 !important;
          }

          .author-tooltip__link-list a:hover,
          .author-tooltip__head a:hover {
            color: #8cb3d9 !important;
          }

          .desktop-onboarding__description,
          .desktop-onboarding-sign-up__form-note,
          .desktop-onboarding-step_sign-up footer,
          .subreddit-picker__subreddit-name strong {
            color: #aaa !important;
          }

          .desktop-onboarding-step_sign-up footer a {
            color: #8cb3d9 !important;
          }

          .desktop-onboarding__col_sign-up_image {
            opacity: 0.7 !important;
          }

          .subreddit-picker,
          .c-username-picker-shown .desktop-onboarding__col_username_picker {
            background-color: #262626 !important;
            border-color: #777 !important;
          }

          .subreddit-picker__category_selected {
            background-color: #333333 !important;
          }

          .api-help .overview h2,
          .api-help .contents .introduction strong {
            color: #aaa !important;
          }

          .api-help .contents .overview code,
          .api-help .parameters {
            background-color: #333333 !important;
          }

          .comment {
            margin: 0 8px 8px 10px !important;
            border: 1px solid #e6e6e6 !important;
            padding: 5px 8px 5px 5px !important;
            overflow: hidden !important;
            border-radius: 3px !important;
            border-color: #333 !important;
          }

          .comment.spam {
            background-image: linear-gradient(#f0a8a8, #f0a8a8) !important;
          }

          .comment .comment {
            margin-right: 0 !important;
          }

          .comment div.child {
            border-left: 1px dotted #555 !important;
          }

          body>.content {
            padding-right: 0 !important;
          }

          a.bylink.parentlink {
            float: right !important;
          }

          #banned {
            position: relative !important;
          }

          #alert_message table.commentPreview td {
            border: 1px solid black !important;
            padding: 1px !important;
            min-width: 25px !important;
          }

          #alert_message table.commentPreview tr:first-child td {
            font-weight: bold !important;
          }

          #alert_message .buttonContainer {
            width: 100% !important;
            display: block !important;
            height: 30px !important;
            margin-bottom: 10px !important;
          }

          #autocomplete_dropdown {
            display: inline-block !important;
            z-index: 10600000 !important;
          }

          .selectedItem {
            color: #fff !important;
            background-color: #5f99cf !important;
          }

          .fieldPair:not([hidden]) {
            display: flex !important;
            margin-bottom: 12px !important;
          }

          .fieldPair-label {
            float: left !important;
            width: 140px !important;
          }

          .fieldPair-text {
            float: left !important;
            min-width: 240px !important;
          }

          .fieldPair-text a {
            display: block !important;
            max-width: 25em !important;
            text-overflow: ellipsis !important;
            overflow: hidden !important;
            white-space: nowrap !important;
          }

          .pageNavigator {
            color: #888 !important;
          }

          .searchpane-toggle-hide {
            float: right !important;
            margin-top: -1em !important;
          }

          .searchpane-toggle-hide::after {
            content: "▲" !important;
            margin-left: 2px !important;
          }

          .searchpane-toggle-show {
            float: right !important;
            display: none !important;
          }

          .searchpane-toggle-show::after {
            content: "▼" !important;
            margin-left: 2px !important;
          }

          .entry {
            padding-right: 5px !important;
          }

          img {
            image-orientation: from-image !important;
          }

          .viewSource>.bottom-area::before {
            display: none !important;
          }

          .viewSource textarea {
            background: repeating-linear-gradient(-225deg,
                transparent,
                transparent 40px,
                rgba(166, 166, 166, 0.05) 40px,
                rgba(166, 166, 166, 0.05) 80px),
              white !important;
          }

          .viewSource textarea[readonly] {
            background: repeating-linear-gradient(-225deg,
                transparent,
                transparent 40px,
                rgba(166, 166, 166, 0.1) 40px,
                rgba(166, 166, 166, 0.1) 80px),
              white !important;
          }

          .subredditInfoToolTip .subredditLabel {
            float: left !important;
            width: 140px !important;
            margin-bottom: 12px !important;
          }

          .subredditInfoToolTip .subredditDetail {
            float: left !important;
            width: 240px !important;
            margin-bottom: 12px !important;
          }

          .subredditInfoToolTip .blueButton {
            float: right !important;
            margin-left: 8px !important;
          }

          .subredditInfoToolTip .redButton {
            float: right !important;
            margin-left: 8px !important;
          }

          .srOver {
            outline: 1px dashed black !important;
          }

          #srList {
            position: absolute !important;
            display: block !important;
            top: 18px !important;
            max-height: calc(100vh - 40px) !important;
            left: 0 !important;
            z-index: 9999 !important;
            border: 1px solid black !important;
            background-color: #fafafa !important;
            width: 320px !important;
            overflow-y: auto !important;
            overscroll-behavior-y: contain !important;
          }

          #srList tbody tr {
            border-bottom: 1px solid gray !important;
          }

          #srList tbody tr:hover {
            background-color: #eef !important;
          }

          #srList thead td {
            cursor: pointer !important;
          }

          #srList td {
            padding: 3px 8px !important;
          }

          #srList td a {
            width: 100% !important;
            display: block !important;
          }

          #srLeftContainer,
          #srDropdown {
            display: inline !important;
            float: left !important;
            position: relative !important;
            z-index: 5 !important;
          }

          #srLeftContainer {
            z-index: 4 !important;
            padding-left: 4px !important;
            margin-right: 6px !important;
          }

          .srSep {
            margin-left: 6px !important;
          }

          #srLeftContainer {
            max-height: 18px !important;
          }

          #userbarToggle {
            min-height: 22px !important;
            position: absolute !important;
            top: 0 !important;
            bottom: 0 !important;
            left: -5px !important;
            width: 16px !important;
            padding-right: 3px !important;
            height: auto !important;
            font-size: 15px !important;
            border-radius: 4px 0 0 4px !important;
            color: #a1bcd6 !important;
            display: inline-block !important;
            background-color: #dfecf9 !important;
            border-right: 1px solid #cee3f8 !important;
            cursor: pointer !important;
            text-align: right !important;
            line-height: 20px !important;
          }

          #userbarToggle {
            background-color: #49505d !important;
            border-right-color: #768594 !important;
          }

          #userbarToggle.userbarShow {
            top: auto !important;
            left: auto !important;
            right: 0 !important;
          }

          #authorInfoToolTip .blueButton {
            float: right !important;
            margin-left: 8px !important;
            margin-top: 12px !important;
          }

          #authorInfoToolTip .redButton {
            float: right !important;
            margin-left: 8px !important;
          }

          @keyframes pop {
            from {
              transform: scale(0, 0) !important;
            }

            to {
              transform: scale(1.5, 1.5) !important;
            }
          }

          .editButton {
            cursor: pointer !important;
            width: 24px !important;
            height: 22px !important;
          }

          div.usertext-edit {
            width: auto !important;
            max-width: 500px !important;
            padding: 0 !important;
          }

          .usertext-edit .md,
          .wiki-page #editform textarea {
            clear: left !important;
          }

          .usertext-edit textarea,
          #wiki_page_content,
          .wiki-page .wiki-page-content #wiki_revision_reason {
            box-sizing: border-box !important;
          }

          .usertext-edit {
            border: none !important;
            background-color: transparent !important;
          }

          .clear {
            clear: both !important;
          }

          .toggleButton {
            position: relative !important;
            display: inline-flex !important;
            cursor: pointer !important;
            white-space: nowrap !important;
          }

          .toggleButton .toggleThumb {
            cursor: pointer !important;
            top: 0 !important;
            left: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            width: 40px !important;
            height: 15px !important;
            background-color: #ccc !important;
            border: 2px solid #ccc !important;
            border-radius: 2px !important;
            transition: 0.1s !important;
            transition-timing-function: ease-in !important;
          }

          .toggleButton.enabled.reverseToggleButton .toggleThumb {
            background-color: #c66 !important;
            border-color: #c66 !important;
          }

          .toggleButton.enabled .toggleThumb {
            background-color: #369 !important;
            border-color: #369 !important;
          }

          .toggleButton .toggleThumb::before {
            position: absolute !important;
            content: "" !important;
            height: 15px !important;
            width: 15px !important;
            left: 2px !important;
            border-radius: 2px !important;
            background-color: white !important;
            transition: 0.4s !important;
          }

          .toggleButton.enabled .toggleThumb::before {
            transform: translateX(25px) !important;
          }

          .toggleButton .toggleLabel {
            display: flex !important;
            flex-direction: column !important;
            justify-content: center !important;
            min-width: 3ex !important;
          }

          .toggleButton .toggleLabel[data-disabled-text]::before {
            content: " "attr(data-disabled-text) !important;
            display: block !important;
            line-height: 0 !important;
            opacity: 1 !important;
          }

          .toggleButton .toggleLabel[data-enabled-text]::after {
            content: "\\a "attr(data-enabled-text) !important;
            display: block !important;
            line-height: 0 !important;
            opacity: 0 !important;
          }

          .toggleButton.enabled .toggleLabel[data-disabled-text]::before {
            opacity: 0 !important;
          }

          .toggleButton.enabled .toggleLabel[data-enabled-text]::after {
            opacity: 1 !important;
          }

          .toggleButton input[type="checkbox"] {
            display: none !important;
          }

          .toggleButton span {
            font-size: 11px !important;
            width: 28px !important;
            line-height: 20px !important;
            display: inline-block !important;
            text-align: center !important;
          }

          .addRowButton {
            cursor: pointer !important;
            padding: 2px 5px !important;
            color: #fff !important;
            border: 1px solid #636363 !important;
            border-radius: 3px !important;
          }

          .addRowButton:hover {
            background-color: #289dee !important;
          }

          .subscription-box .subButtons {
            font-size: larger !important;
          }

          span.multi-count {
            background: #ff7500 !important;
            color: white !important;
          }

          .blueButton {
            cursor: pointer !important;
            padding: 3px 5px !important;
            font-size: 12px !important;
            line-height: 15px !important;
            color: #fff !important;
            border: 1px solid #636363 !important;
            border-radius: 3px !important;
            background-color: #107ac4 !important;
          }

          .redButton {
            cursor: pointer !important;
            margin-top: 12px !important;
            padding: 3px 5px !important;
            font-size: 12px !important;
            line-height: 15px !important;
            color: #fff !important;
            border: 1px solid #bc3d1b !important;
            border-radius: 3px !important;
            background-color: #ff5757 !important;
          }

          .noCtrlF::before {
            content: attr(data-text) !important;
          }

          .transitionToTransparent {
            transition: opacity 3s cubic-bezier(0.82, 0, 1, 0.55) !important;
            opacity: 0 !important;
          }

          @keyframes spin {
            100% {
              transform: rotate(360deg) !important;
            }
          }

          #alert_message {
            position: fixed !important;
            top: 0 !important;
            right: 0 !important;
            left: 0 !important;
            box-sizing: border-box !important;
            width: 500px !important;
            max-height: 100% !important;
            margin: auto !important;
            padding: 10px !important;
            color: black !important;
            text-align: left !important;
            font-size: 12px !important;
            border: 1px solid !important;
            background-color: #efefef !important;
            overflow: auto !important;
            z-index: 11000000 !important;
          }

          @media (max-width: 520px) {
            #alert_message {
              width: auto !important;
              left: 10px !important;
              right: 10px !important;
            }
          }

          @media (max-height: 520px) {
            #alert_message {
              height: auto !important;
              bottom: 10px !important;
            }
          }

          #alert_message input {
            border: 1px solid !important;
            padding: 6px 9px !important;
            float: left !important;
            background-color: #dfdfdf !important;
            cursor: pointer !important;
            margin-right: 10px !important;
          }

          #alert_message input.button-right {
            float: right !important;
          }

          #alert_message>div {
            margin-bottom: 20px !important;
          }

          #alert_message_background {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            bottom: 0 !important;
            right: 0 !important;
            background-color: rgba(0, 0, 0, 0.7) !important;
            z-index: 10999999 !important;
          }

          #show_stylesheets:target+label {
            background-color: lightblue !important;
          }

          .handle {
            cursor: grab !important;
          }

          .durationField input[type="number"] {
            width: 3em !important;
          }

          .checkset {
            display: inline-block !important;
          }

          .checkset input[type="checkbox"] {
            display: none !important;
          }

          .checkset label {
            border: thin grey solid !important;
            background-color: white !important;
            padding: 2px 4px !important;
            cursor: pointer !important;
          }

          .checkset label:first-of-type {
            border-top-left-radius: 6px !important;
            border-bottom-left-radius: 6px !important;
          }

          .checkset label:last-of-type {
            border-top-right-radius: 6px !important;
            border-bottom-right-radius: 6px !important;
          }

          .checkset *:checked+label {
            background-color: darkgrey !important;
            text-decoration: underline !important;
          }

          .tabmenu {
            user-select: none !important;
            display: inline-block !important;
          }

          .tabmenu a {
            cursor: pointer !important;
          }

          .tabmenu a[aftercontent]::after {
            content: attr(aftercontent) !important;
          }

          .tabmenu .selected a:not(:only-child):first-child {
            border-right: none !important;
          }

          .tabmenu .selected a:not(:only-child):last-child {
            border-left: none !important;
          }

          .pinnable-content.pinned .dismiss-pinnable {
            top: 30px !important;
          }

          /* Update 1.11 */
          /* Hide "What's Happening Now" */
          .happening-now-wrap {
            display: none !important;
          }

          /* Fix Color Formatting */
          body, body .content, .modal-body, .side, .icon-menu a, .side .leavemoderator, .side .leavecontributor-button, .side .titlebox, .side .spacer .titlebox .redditname, .side .titlebox .flairtoggle, .side .usertext-body .md ol, .side .usertext-body .md ol ol, .side .usertext-body .md ol ol li, .modactionlisting table *, .side .recommend-box .rec-item, .crosspost-preview, .crosspost-thing-preview, .admin_takedown {
            background-color: rgb(38, 38, 38) !important;
            border-color: rgb(119, 119, 119) !important;
          }

          /* Make Link Colors at top of page darker */
          .sr-list a {
            color: #000000 !important;
          }

          /******** End Update 1.11 ********/

          /* Update 1.12 */

          /* Change subreddit link color */
          span[class="hover pagename redditname"] a {
            color: #000000 !important;
          }

          /* Fix search box */
          #search>input[type=submit] {
            cursor: pointer !important;
            padding: 2px 6px 3px !important;
            color: rgb(255, 255, 255) !important;
            background-color: transparent !important;
            background-repeat: no-repeat !important;
            height: 13px !important;
            width: 13px !important;
            -webkit-box-sizing: border-box !important;
            border: none !important;
            margin: 0 !important;
            margin-left: -22px !important;
            vertical-align: middle !important;
            background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAMAAACelLz8AAAAb1BMVEUAAACJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYm4Po3NAAAAJXRSTlMAAQIEDBAREhMUJS0uQ09QV19hZG1udHmbnJ64xMXGx8jOz9DUayO31AAAANNJREFUeAGF0fFugjAUhfGDg3W1blMEC2IV8Lz/My4nEnK7jOz3380nN7XFy0fdJzL1tUeujBMXUyxh7Acaw96UBzPj2sqBmtuDc6Edqe+0U6Km/v01VJ2muJxtUnnDYqc2e0itbRVWlXbWkJ5kC6MleYUkkgcYgWSCkKSD4Uiy+CdpYfi98Pb3MRqS3fbhzxA/61e77C8/vbmorrIXdcmvtwnOhWaknNZH0Zw7mqfcbGWcuXheTqaJr6+JvHVnDxzzJkUBUZNvZGy7Y7PZZH097p8/V4YmEaKXKKIAAAAASUVORK5CYII=') !important;
            background-size: 13px 13px !important;
            background-position: 0 0 !important;
          }

          /* Moved header bar to top, added configuration option. */
          /* Added bug fix for style not working on Cascadea 2.0.1/Safari 14.0.1 (16610.2.11.51.8) */
          /******** End Update 1.12 ********/
        `;
        document.head.appendChild(style);
      }
    } else {
      document.getElementById(styleId)?.remove();
    }
  }

  const headerArea = document.getElementById("sr-header-area");
  if (headerArea) {
    const betaOptin = headerArea.querySelector(".redesign-beta-optin");
    const premiumBanner = headerArea.querySelector(".premium-banner-outer");

    if (betaOptin) {
      betaOptin.remove();
    }
    if (premiumBanner) {
      premiumBanner.remove();
    }
  }
  const style = document.createElement("style");
  style.textContent = `
            .premium-banner {
                display: none !important;
            }
        `;
  document.head.appendChild(style);

  window.addEventListener("load", () => {
    toggleHideMultibar(GM_getValue(config.hideMultibar));
    toggleHideBell(GM_getValue(config.hideBell));
    toggleHideChat(GM_getValue(config.hideChat));
    toggleAddUserPrefix(GM_getValue(config.addUserPrefix));
    toggleHideArchivedArrows(GM_getValue(config.hideArchivedArrows));
    toggleOldCommentFont(GM_getValue(config.oldCommentFont));
    toggleFullUserScores(GM_getValue(config.fullUserScores));
    toggleOldRedditIcons(GM_getValue(config.oldRedditIcons));
    toggleExpandoButtons(GM_getValue(config.expandoButtons));
    toggleClassicRESNight(GM_getValue(config.classicRESNight));
    toggleSubmitUnderlay(GM_getValue(config.enableSubmitUnderlay));
    toggleClassicResBorderHighlight(
      GM_getValue(config.classicResBorderHighlight)
    );
    classicFlair(GM_getValue(config.classicFlair)); // Call classicFlair on load
    toggleDarkMode(GM_getValue(config.darkMode));
  });

  if (
    window.location.hostname === "old.reddit.com" ||
    window.location.hostname === "www.reddit.com"
  ) {
    initializeViewCounter();
    initializeVoteEstimator();
  }
})();