// ==UserScript==
// @name Codeforces Optimal Theme
// @version 3.9
// @description Easy to read and saves your eyes. Most colors and styles of elements are choosed using Golden Ratio Technique. Currently doesn't support Codeforces Blog.
// @author Roman Lukyanchikov
// @match http://codeforces.com/*
// @match https://codeforces.com/*
// @exclude http://codeforces.com/blog/*
// @exclude https://codeforces.com/blog/*
// @exclude http://codeforces.com/comments/*
// @exclude https://codeforces.com/comments/*
// @exclude http://codeforces.com/10years?comments=true#comments
// @exclude https://codeforces.com/10years?comments=true#comments
// @grant GM_addStyle
// @run-at document-start
// @namespace https://gf.qytechs.cn/users/687494
// ==/UserScript==
document.getElementsByTagName('head')[0].innerHTML += '<link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Istok+Web:ital,wght@0,400;0,700;1,400;1,700&family=PT+Sans+Caption:wght@400;700&display=swap" rel="stylesheet">';
GM_addStyle("body {background-color: #CFCFCF !important; color: black; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".roundbox.menu-box {border: 1px solid gray !important; background-color: #B0B0B0 !important;}");
GM_addStyle(".roundbox pre {background-color: white !important;}");
GM_addStyle("div.source-copier {color: white !important; border-color: gray !important; background-color: #303030 !important; border-radius: 6px !important;}");
GM_addStyle("div.source-copier:hover {color: black !important; border-color: #CFCFCF !important; background-color: white !important; border-radius: 6px !important;}");
GM_addStyle("div.roundbox.highlight-blue.sidebox.smaller {background-color: #CFE7FF !important;}");
GM_addStyle(".ttypography {color: black !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".ttypography .problem-statement .header {color: black !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".ttypography .problem-statement .header .title {color: black !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".ttypography a:hover {background-color: #B0D7FF !important;}");
GM_addStyle(".ttypography a:focus {background-color: #B0D7FF !important;}");
GM_addStyle(".datatable td .notice.small {color: #4F4F4F !important;}");
GM_addStyle(".datatable thead {background-color: #B0B0B0 !important;}");
GM_addStyle("span.notice {color: #4F4F4F !important;}");
GM_addStyle("div.notice {color: #4F4F4F !important;}");
GM_addStyle(".custom-links-pagination a {color: #4F4F4F !important;}");
GM_addStyle(".custom-links-pagination .active {color: black !important;}");
GM_addStyle(".roundbox .roundbox-lt {background: none !important;}");
GM_addStyle(".roundbox .roundbox-rt {background: none !important;}");
GM_addStyle(".roundbox .roundbox-lb {background: none !important;}");
GM_addStyle(".roundbox .roundbox-rb {background: none !important;}");
GM_addStyle(".roundbox {border: 1px solid gray !important; background-color: #B0B0B0 !important; border-radius: 6px !important;}");
GM_addStyle(".topic .notice {color: #4F4F4F !important;}");
GM_addStyle(".topic .title p {color: black !important; font-family: 'PT Sans Caption', sans-serif !important; font-size: 1em !important;}");
GM_addStyle(".menu-box .search {color: #4F4F4F !important; border: 0px solid #B0B0B0; background: #CFCFCF url(https://codeforces.com/images/search-16x16.png) 2px 2px no-repeat}");
GM_addStyle(".contest-state-phase {color: #0067CF !important;}");
GM_addStyle(".roundbox .caption {color: #0067CF !important;}");
GM_addStyle(".roundbox.meta {border: 1px solid gray !important; background-color: #B0B0B0 !important;}");
GM_addStyle(".left-meta span {color: #009100;}");
GM_addStyle(".ttypography p {line-height: 1.62em !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".topic .content {border-left: 6px solid #B0B0B0 !important; !important; font-size: 1em !important; line-height: 1.62em !important;}");
GM_addStyle(".countdown {color: #4F4F4F !important;}");
GM_addStyle(".propertyLinks span {color: #4F4F4F !important;}");
GM_addStyle(".roundbox .titled {border-bottom: 1px solid gray !important;}");
GM_addStyle(".roundbox .dark {background-color: #CFCFCF !important;}");
GM_addStyle(".bottom-links {background-color: #B0B0B0 !important; border-top-color: grey !important;}");
GM_addStyle(".handleForm input {background-color: #CFCFCF !important;}");
GM_addStyle(".pagination span.active {background-color: #B0B0B0 !important; border: none !important;}");
GM_addStyle(".lang-chooser div {background-color: #CFCFCF !important;}");
GM_addStyle(".highlights {color: #4F4F4F !important;}");
GM_addStyle(".search-help code {background: #CFCFCF !important; border: none !important; }");
GM_addStyle(".search-large {background: #CFCFCF url(https://codeforces.com/images/search-24x24.png) 2px 2px no-repeat !important; color: #4F4F4F !important; border: none !important;}");
GM_addStyle(".ac_over {background-color: #303030 !important; color: white !important;}");
GM_addStyle(".ac_odd {background-color: #CFCFCF;}");
GM_addStyle(".ac_even {background-color: #B0B0B0;}");
GM_addStyle(".button-up {color: #4F4F4F !important;}");
GM_addStyle(".menu-list li.current {border-bottom: 3px solid #303030 !important;}");
GM_addStyle(".menu-list li a, .menu-list li a:visited {color: black !important;}");
GM_addStyle(".contest-name a, .contest-name a:visited {color: #303030 !important;}");
GM_addStyle(".title-photo div {border: none !important;}");
GM_addStyle(".main-info div {color: #4F4F4F !important;}");
GM_addStyle(".roundbox .rtable td {border: 1px solid gray !important;}");
GM_addStyle(".roundbox .rtable th {border: 1px solid gray !important; border-top: none !important;}");
GM_addStyle(".datatable {background-color: #B0B0B0 !important; border: 1px solid gray !important; border-radius: 6px !important;}");
GM_addStyle(".datatable tbody {background-color: #B0B0B0 !important;}");
GM_addStyle(".datatable tbody .dark {background-color: #CFCFCF;}");
GM_addStyle(".lt {background: none !important;}");
GM_addStyle(".rt {background: none !important;}");
GM_addStyle(".lb {background: none !important;}");
GM_addStyle(".rb {background: none !important;}");
GM_addStyle(".ilt {background: none !important;}");
GM_addStyle(".irt {background: none !important;}");
GM_addStyle(".ilb {background: none !important;}");
GM_addStyle(".irb {background: none !important;}");
GM_addStyle(".contests-table {background: #CFCFCF}");
GM_addStyle(".comment-table .reply a {color: #4F4F4F !important;}");
GM_addStyle(".vote-for-comment img {opacity: 0.81 !important;}");
GM_addStyle(".comment-table {border-color: #B0B0B0 !important;}");
GM_addStyle(".problem-statement .sample-tests pre {background-color: #303030 !important; color: white !important;}");
GM_addStyle(".input-output-copier {border-color: gray !important;}");
GM_addStyle(".problem-statement .sample-tests .title .input-output-copier {color: white !important; border-color: gray !important; background-color: #303030 !important; border-radius: 6px !important;}");
GM_addStyle(".problem-statement .sample-tests .title {color: black !important; border-color: gray !important; background-color: #B0B0B0 !important;}");
GM_addStyle(".problem-statement .sample-tests .title .input-output-copier:hover {color: black !important; border-color: #CFCFCF !important; background-color: white !important; border-radius: 6px !important;}");
GM_addStyle(".problem-statement .sample-tests .input, .problem-statement .sample-tests .output {border-color: gray !important;}");
GM_addStyle(".title {border-color: gray !important;}");
GM_addStyle(".verdict-accepted {color: #009100 !important;}");
GM_addStyle(".verdict-rejected {color: blue !important;}");
GM_addStyle(".verdict-waiting {color: #4F4F4F !important;}");
GM_addStyle(".verdict-accepted-challange {color: #009100 !important;}");
GM_addStyle(".verdict-successful-challenge {color: #009100 !important;}");
GM_addStyle("span.verdict-unsuccessful-challenge {color: blue !important;}");
GM_addStyle(".accepted-problem {color: #4F4F4F !important;}");
GM_addStyle(".datatable td {border-color: gray !important;}");
GM_addStyle(".datatable td[background-color^='none'], .datatable th[background-color^='none'] {background: #CFCFCF !important; background-color: #CFCFCF !important;}");
GM_addStyle(".datatable th {border-color: gray !important;}");
GM_addStyle(".datatable td.state[style^='back'] .notice {color: #4F4F4F !important;}");
GM_addStyle(".contest-state-regular.countdown {color: #4F4F4F !important;}");
GM_addStyle(".roundbox .rtable td .contest-state-regular {color: #4F4F4F !important;}");
GM_addStyle("a:link.notice {color: #4F4F4F !important;}");
GM_addStyle(".problems tr.accepted-problem td.act {background-color: #80FF80 !important;}");
GM_addStyle(".problems tr.accepted-problem td.id {border-left-color: #80FF80 !important;}");
GM_addStyle(".problems tr.rejected-problem td.act {background-color: #FF8080 !important;}");
GM_addStyle(".problems tr.rejected-problem td.id {border-left-color: #FF8080 !important;}");
GM_addStyle(".datatable td.state[style^='background-color: rgb(221, 238, 255);'] {background-color: #CFE7FF !important;}");
GM_addStyle(".datatable td.state[style^='background-color: rgb(212, 237, 201);'] {background-color: #80FF80 !important;}");
GM_addStyle(".setting-name {color: #0067CF !important;}");
GM_addStyle(".ProblemRating {color: black !important;}");
GM_addStyle(".standings .cell-accepted {color: #009100 !important;}");
GM_addStyle(".standings .cell-accepted-locked {color: #004F00 !important;}");
GM_addStyle(".standings .cell-passed-system-test {color: #009100 !important;}");
GM_addStyle("span.cell-rejected {color: #4F4F4F !important;}");
GM_addStyle(".standings .cell-challenged {color: red !important;}");
GM_addStyle(".cell-time {color: #4F4F4F !important;}");
GM_addStyle(".unsuccessfulChallengeCount {color: #4F4F4F !important;}");
GM_addStyle(".sidebar-menu ul li {border: none !important;}");
GM_addStyle(".sidebar-menu ul li:hover {border: 1px solid gray !important; background-color: #CFCFCF !important; color: black !important;}");
GM_addStyle(".comment-table.highlight-blue, .comment-table.highlight, .standings tr.highlighted-row td, table tr.highlighted-row td, .highlight-blue, .lang-chooser div[style^='background-color: #EAF4FF;'] {background-color: #CFE7FF !important;}");
GM_addStyle("select {background-color: #CFCFCF !important; color: black !important;}");
GM_addStyle("input {background-color: #CFCFCF !important; color: black !important;}");
GM_addStyle("textarea {background-color: #CFCFCF !important; color: black !important;}");
GM_addStyle(".topic div[style^='font-size: 1.1rem;line-height: 1.1rem;padding-bottom: 0.5em;'] img {filter: invert(0.69) !important;}");
GM_addStyle("img[title^='Attach this blog to some contest as a resource'] {filter: invert(0.69) !important;}");
GM_addStyle("img[title^='Прикрепить данный блог к какому-либо соревнованию'] {filter: invert(0.69) !important;}");
GM_addStyle("div[style^='width:35em;margin-left:auto;'] {color: #4F4F4F !important;}");
GM_addStyle("#facebox .content, .talk-content div[id^='history-text-content'] {background: #CFCFCF !important; background-color: #CFCFCF !important;}");
GM_addStyle("a:not([href]):not(.rated-user), a:link:not(.rated-user) {color: #0058B0;}");
GM_addStyle("a:visited:not(.rated-user) {color: #3737B0 !important;}");
GM_addStyle("div.ttypography {font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle("div.ttypography .bordertable tbody td {border: 1px solid gray !important;}");
GM_addStyle("div.ttypography .bordertable tbody th {border: 1px solid gray !important;}");
GM_addStyle("div.ttypography .bordertable tbody tr:hover td {background-color: #B0B0B0 !important;}");
GM_addStyle("div.ttypography .bordertable tbody tr:hover th {background-color: #B0B0B0 !important;}");
GM_addStyle(".datatable td[style^='background-color: rgb(212, 237, 201);'] {background-color: #B0FFB0 !important;}");
GM_addStyle(".datatable td[style^='background-color: rgb(255, 227, 227);'] {background-color: #FFB0B0 !important;}");
GM_addStyle(".left-meta span[style^='font-size:larger;position:relative;bottom:1px;font-weight:bold;color:gray'] {color: #4F4F4F !important;}");
GM_addStyle(".contestParticipantCountLinkMargin img {filter: invert(0) !important;}");
GM_addStyle("li span[style^='color:#009100;font-weight:bold;'] {color: #009100 !important;}");
GM_addStyle("span[style^='color:gray;font-weight:bold;'] {color: #4F4F4F !important;}");
GM_addStyle("span[style^='color:green;font-weight:bold;'] {color: #009100 !important;}");
GM_addStyle("a:visited[style^='text-decoration: none;font-size: 18.0px;background-color: rgb(1,87,155);color: white;font-weight: bold;padding: 0.5em 1.0em;'] {color: white !important;}");
GM_addStyle("a:link.red-link, a:link.red-link:visited, .red-link, a.red-link:visited {background-color: #303030 !important; color: yellow !important;}");
GM_addStyle(".rated-user.user-black {font-family: 'PT Sans Caption', sans-serif !important; font-weight: 400 !important;}");
GM_addStyle(".rated-user {font-family: 'PT Sans Caption', sans-serif !important; font-weight: 700 !important;}");
GM_addStyle("tr.user-orange td, span.user-orange, a.user-orange {color: #E05A00 !important;}");
GM_addStyle("tr.user-violet td, span.user-violet, a.user-violet {color: darkviolet !important;}");
GM_addStyle("tr.user-cyan td, span.user-cyan, a.user-cyan {color: darkcyan !important;}");
GM_addStyle("tr.user-gray td, span.user-gray, a.user-gray {color: #4F4F4F !important;}");
GM_addStyle("tr.user-green td, span.user-green, a.user-green {color: green !important;}");
GM_addStyle("tr.user-blue td, span.user-blue, a.user-blue {color: blue !important;}");
GM_addStyle(".sidebar-menu ul li.active {background-color: gray !important; border: 1px solid #4F4F4F !important;}");
GM_addStyle(".highlight-blue.roundbox {background-color: #FFFFCF !important;}");
GM_addStyle("div[style^='font-size:2em;color:#3B5998;float:right;'] {color: #0067CF !important;}");
GM_addStyle("div .topic .title a, div .topic .title a:hover {color: #0067CF !important;}");
GM_addStyle("div .topic .title a:visited {color: #3737B0 !important;}");
GM_addStyle("div[style^='text-align:right;color:#888;font-size:1.1rem;margin-bottom:0.25em;'] {color: #4F4F4F !important;}");
GM_addStyle("span[style^='color: darkorange; font-weight: bold;'] {color: olive !important;}");
GM_addStyle(".contest-name {color: black !important;}");
GM_addStyle(".contest-name a {font-size: 1em !important; color: black !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle(".contest-name a:visited {font-size: 1em !important; color: black !important; font-family: 'PT Sans Caption', sans-serif !important;}");
GM_addStyle("._StreamsSidebarFrame_countdown._StreamsSidebarFrame_timeMark {color: #4F4F4F !important;}");
GM_addStyle("._StreamsSidebarFrame_active._StreamsSidebarFrame_timeMark {color: #4F4F4F !important;}");
GM_addStyle("._StreamsSidebarFrame_stream {border-bottom: 1px solid gray !important;}");
GM_addStyle("ins[style^='background:#80ff80;overflow-wrap:break-word;'] {background: #B0FFB0 !important;}");
GM_addStyle("del[style^='background:#ff8080;overflow-wrap:break-word;'] {background: #FFB0B0 !important;}");
GM_addStyle("input[class^='submit'] {background: #4F4F4F !important; border: none !important; border-radius: 6px !important; color: white !important;}");
GM_addStyle("input[class^='submit']:hover {background: #303030 !important; border: 2px solid #4F4F4F !important; border-radius: 6px !important; color: white !important;}");
GM_addStyle(".header-bell__img {filter: brightness(0.81)}");
GM_addStyle(".fieldset, img[alt='Codeforces'] {filter: brightness(0.81)}");
GM_addStyle("img[src='//assets.codeforces.com/images/hsu.png'] {filter: brightness(0.81)}");
GM_addStyle(".header-bell .bell-details__no-new {color: #4F4F4F !important;}");