:root {
    --black: #111315;
    --white: #cbcdcf;
    --green: #309e5e;
    --faint: #cbcdcf20;
    --light-grey: #a0a2a4;
    --grey: #202224;
    --code-bg: #55555580;
}

::selection {
    background: var(--green);
    color: var(--black);
}

html,
body,
div,
nav,
header,
main,
ul,
ol {
    margin: 0;
    padding: 0;
    border: 0;
}

html {
    width: auto;
    height: auto;
    min-height: 100vh;
}

body {
    width: 100%;
    height: 100%;
    min-height: 100vh;

    background-color: var(--black);
    color: var(--white);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif, sans-serif,
        sans;
    line-height: 1.4;
    font-size: 1rem;
    -webkit-text-size-adjust: 100%;
}

b,
strong {
    font-weight: bolder;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0.25rem 0 0.25rem 0;
    width: auto;
    max-width: 60rem;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.75em;

    padding-bottom: 0.25rem;
    border-bottom: 1px solid #cbcdcf60;
}

h2:hover::after {
    color: var(--faint);
    content: ' ##';
}

h3,
h4,
h5,
h6 {
    text-decoration-color: var(--faint);
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 0.125rem;
}

h3 {
    font-size: 1.5em;
}

h3:hover::after {
    color: var(--faint);
    content: ' ###';
}

h4 {
    font-size: 1.3333em;
}

h4:hover::after {
    color: var(--faint);
    content: ' ####';
}

h5 {
    font-size: 1.25em;
}

h5:hover::after {
    color: var(--faint);
    content: ' #####';
}

h6 {
    font-size: 1.2em;
}

h6:hover::after {
    color: var(--faint);
    content: ' ######';
}

header {
    margin-bottom: 2rem;
    color: var(--green);
}

hr {
    border: 0.125rem solid var(--faint);
    margin: 0.5rem 0 0.5rem 0;
    padding: 0;
}

p,
blockquote {
    max-width: 60rem;
    padding: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    text-overflow: ellipsis;
}

p {
    margin: 1rem 0 1rem 0;
    border: 0;
}

blockquote {
    margin: 1rem 0 1rem 1.5rem;
    padding: 0 0 0 0.6667rem;
    border-left: 0.3333rem solid var(--faint);
}

p + h1,
p + h2,
p + h3,
p + h4,
p + h5,
p + h6,
ul + h1,
ul + h2,
ul + h3,
ul + h4,
ul + h5,
ul + h6,
ol + h1,
ol + h2,
ol + h3,
ol + h4,
ol + h5,
ol + h6,
figure + h1,
figure + h2,
figure + h3,
figure + h4,
figure + h5,
figure + h6,
blockquote + h1,
blockquote + h2,
blockquote + h3,
blockquote + h4,
blockquote + h5,
blockquote + h6,
table + h1,
table + h2,
table + h3,
table + h4,
table + h5,
table + h6,
p + a h1,
p + a h2,
p + a h3,
p + a h4,
p + a h5,
p + a h6,
ul + a h1,
ul + a h2,
ul + a h3,
ul + a h4,
ul + a h5,
ul + a h6,
ol + a h1,
ol + a h2,
ol + a h3,
ol + a h4,
ol + a h5,
ol + a h6,
figure + a h1,
figure + a h2,
figure + a h3,
figure + a h4,
figure + a h5,
figure + a h6,
blockquote + a h1,
blockquote + a h2,
blockquote + a h3,
blockquote + a h4,
blockquote + a h5,
blockquote + a h6,
table + a h1,
table + a h2,
table + a h3,
table + a h4,
table + a h5,
table + a h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
}

a {
    color: #5ee496;
}

a:hover,
a:visited,
a:active {
    color: #3fa187;
}

a:hover {
    text-decoration: none;
}

a.h-anchor {
    color: inherit;
    text-decoration: inherit;
}

ul,
ol {
    list-style-position: outside;

    max-width: 60rem;
    margin: 1rem 0 1rem 2rem;
    border: 0;
    padding: 0;

    overflow-wrap: anywhere;
    white-space: normal;
}

ul {
    list-style-type: '\1f34f\a0';
}

ul ul,
ul ol,
ol ul,
ol ol {
    margin-top: 0;
    margin-bottom: 0;
}

li {
    white-space: normal;
}

abbr[title] {
    border-bottom: none;
    text-decoration: underline;
    text-decoration: underline dotted;
    text-decoration: underline dotted var(--white);
}

figure {
    margin: 0.5rem 0 0.5rem 1.5rem;
    padding: 0;
    border: 0;
    overflow: auto;
}

code,
pre,
kbd {
    font-family: monospace, monospace, mono;
}

code {
    font-size: 85%;
    padding: 0.1rem 0.2rem 0.1rem 0.2rem;
    border-radius: 0.25rem;
    color: white;
    background-color: var(--code-bg);
}

pre {
    font-size: 100%;
    padding: 0.75rem;
    scroll-padding: 0.75rem;
    border-radius: 0.5rem;
    overflow: auto;
}

kbd {
    display: inline-block;
    padding: 0.25rem 0.3rem;
    font-size: 75%;
    line-height: 70%;
    color: white;
    vertical-align: middle;
    background-color: var(--code-bg);
    border: 0.1rem solid var(--light-grey);
    border-radius: 0.2rem;
    box-shadow: inset 0 -0.1rem var(--light-grey);
}

footer {
    margin-top: 0.5rem;
}

cite {
    font-style: italic;
}

table,
thead,
tbody,
tr,
th,
td {
    border-collapse: collapse;
}

.table-wrapper {
    margin: 1rem 0 1rem 0;
    width: 100%;
    max-width: 60rem;
    overflow: auto;
}

table {
    height: 0;
}

thead > tr,
table > tbody > tr:nth-of-type(even) {
    background-color: #00000060;
}

table > thead > tr > th:nth-of-type(n+2),
table > tbody > tr > td:nth-of-type(n+2) {
    border-left: 0.25rem double var(--faint);
}

tr {
    margin: 0;
    padding: 0;
}

td,
th {
    margin: 0;
    padding: 0.5rem;
    border-width: 0.0625rem;
    border-style: solid;
    border-color: var(--faint);
}

th {
    font-weight: bolder;
}

td {
    font-weight: normal;
}

td ul,
td ol,
th ul,
th ol {
    list-style-position: inside;
}

details {
    box-sizing: border-box;
    max-width: 60rem;
    border: 0.125rem solid var(--faint);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem 0.25rem 0.5rem;

    background-color: #00000060;
}

li > img {
    vertical-align: middle;
}

fieldset {
    border: 0.125rem solid var(--faint);
    margin: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 0.75rem;
    box-shadow: 0 0 1rem #000000a0;
}

label {
    margin: 0.125rem 0.5rem 0.125rem 0.5rem;
    vertical-align: middle;

    word-break: normal;
    overflow-wrap: anywhere;
    white-space: nowrap;
}

input,
select,
button {
    vertical-align: middle;
    padding: 0.25rem;

    background-color: #080a0c !important;
    color: var(--white) !important;
    border: 0.125rem solid var(--grey);
}

button:hover {
    cursor: pointer;
    /* offset-x | offset-y | blur-radius | spread-radius | color */
    box-shadow: 0 0 0.25rem 0 var(--white);
    background-color: #12171b !important;
    color: white !important;
}

#nav-content-wrapper {
    width: 100%;
    height: 100%;
    min-height: 100vh;

    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
}

#main-nav {
    display: block;

    flex-basis: 16rem;
    flex-grow: 1;
    max-width: 16rem;

    background-color: #27292b;
    box-shadow: 0 0 1rem inset #000000a0;
}

#main-nav-inner {
    position: -webkit-sticky;
    position: sticky;

    top: 0;
    left: 0;

    margin: 0;
    padding: 0;
    border: 0;
}

#main-nav-pullout {
    display: none;
    position: relative;

    width: 100%;
    height: 100%;
    z-index: 64;
    float: none;

    background-color: #27292b;
    font-size: 1rem;
    -webkit-text-size-adjust: 100%;
    text-align: center;
}

#main-nav a {
    text-decoration: none;
    font-size: 1.5rem;
}

.nav-h {
    display: inline-block;
    width: 100%;
    padding: 0.5rem 0 1.5rem 0;

    font-weight: bolder;
    text-align: center;
    color: var(--green);
}

.nav-h:hover,
.nav-h:active,
.nav-h:focus {
    text-shadow: #309e5ea0 0 0 1rem;
}

.nav-h > img {
    max-height: 4rem;
    padding: 0.5rem 0.5rem 0 0.5rem;
    filter: drop-shadow(0 0 1rem #000000a0);
}

.nav-h:hover > img {
    filter: drop-shadow(0 0 1rem #309e5ea0);
}

.nav-list {
    margin: 0;
    list-style: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-list > li {
    min-width: max-content;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

ul.nav-list > li.active {
    background-color: var(--black);
    box-shadow: -0.5rem 0 1rem #000000a0;
}

.nav-list > li:hover,
.nav-list > li:active,
.nav-list > li:focus {
    background-color: #309e5e80;
}

.nav-list > li > a {
    display: inline-block;
    width: 100%;
    height: 100%;
    padding: 0.25rem 1rem 0.25rem 0.5rem;

    color: var(--white);
}

#content {
    padding: 1rem;
    flex-grow: 4;
    min-width: 0;
}

/* Collapse side menu on small screen widths */
@media(max-width: 40rem) {
    #main-nav {
        padding: 0;
        flex-basis: 1rem;
    }

    #main-nav .nav-h,
    #main-nav .nav-list {
        border: 0;
        clip-path: polygon(0 0, 0 0, 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }

    #main-nav:hover .nav-h,
    #main-nav:active .nav-h,
    #main-nav:focus .nav-h,
    #main-nav:hover .nav-list,
    #main-nav:active .nav-list,
    #main-nav:focus .nav-list {
        clip-path: none;
        height: auto;
        margin: 0;
        overflow: visible;
        position: static;
        white-space: normal;
        width: auto;
    }

    #main-nav:hover .nav-list > li > a,
    #main-nav:active .nav-list > li > a,
    #main-nav:focus .nav-list > li > a {
        width: 100%;
        height: 100%;
        padding: 0.25rem 1rem 0.25rem 0.5rem;
    }

    #main-nav:hover .nav-h,
    #main-nav:active .nav-h,
    #main-nav:focus .nav-h {
        width: 100%;
        padding: 0.5rem 0 0.5rem 0; /* 0.5rem 0.5rem 1.5rem 0.5rem */
    }

    #main-nav-pullout {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: center;
        align-content: center;
        justify-content: center;

        min-height: 100vh;

        box-shadow: 0 0 1rem inset #000000a0;
    }

    #main-nav-pullout > span {
        padding: 0 1px 0 1px;
        color: white;
    }

    #main-nav:hover #main-nav-pullout,
    #main-nav:active #main-nav-pullout,
    #main-nav:focus #main-nav-pullout {
        display: none;
    }

    #main-nav-pullout:hover,
    #main-nav-pullout:active,
    #main-nav-pullout:focus {
        display: none;
    }

    #content {
        padding: 0.5rem;
    }
}

.subtitle {
    margin-left: 1.5rem;
    text-decoration-color: var(--faint);
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 0.125rem;
}

.go-back {
    text-decoration: none;
    font-size: 85%;
    background-color: var(--grey);
    border: 1px solid var(--faint);
    border-radius: 0.5rem;

    margin-bottom: 0.5rem;
    padding: 1px 0.25rem 1px 0.25rem;
}

.go-back,
.go-back:visited,
.go-back:active {
    color: #5ee496;
}

.go-back:hover {
    color: #3fa187;
}

.align-none {
    text-align: start;
}

.align-left {
    text-align: left;
}

.align-center {
    text-align: center;
}

.align-right {
    text-align: right;
}

#save-load-div,
#calculator-input,
#calculator-output {
    margin: 0.25rem 0 0.25rem 0;
    width: auto;
    max-width: 60rem;
}

#save-load-div,
#calculator-input {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    align-content: start;
}

#save-load-div > label,
#calculator-input > label {
    border: 0.125rem solid var(--faint);
    margin: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 0.75rem;
    box-shadow: 0 0 1rem #000000a0;
}

#currently-loaded {
    font-family: monospace;
    display: block;
    margin: 0 0 0.5rem 0;
}

#save-load-dialog {
    display: block;
    margin: 0.5rem 0 0 0;
}

#load-select {
    font-family: monospace;
}

#stats {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: start;
    align-items: stretch;
}

#stats > label {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
}

#stats > label > input {
    margin-left: 0.33333rem;
}

#calculator-output {
    margin-bottom: 8rem;
    border: 0;
    border-top: 0.125rem solid var(--faint);
    padding: 0.5rem;
}

.error {
    color: #ec6163;
}

.warning {
    color: #fff243;
    list-style-type: '\26a0\a0';
}

.success {
    color: var(--green);
}

#noscript {
    max-width: 60rem;
    height: auto;
    margin: 1rem 0 1rem 0;
    padding: 1px 0.5rem 1px 0.5rem;

    color: var(--black);
    background-color: var(--green);
}

#noscript a {
    color: #223858;
}

.hide {
    border: 0;
    clip-path: polygon(0 0, 0 0, 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.help {
    cursor: help;
}

.plain-ul {
    list-style-type: disc;
}

.inline-ul {
    display: inline;
    list-style: none;
    margin: 0;
    padding: 0;
    border: none;
}

.inline-ul > li {
    display: inline;
}

.inline-ul > li::after {
    content: ', ';
}

.inline-ul > li:last-child::after {
    content: '';
}
