

:root {
    /* Color */
    --bg-gray: #444;
    --hacker-green: #080;
    --hacker-gray: #333;
    --hacker-gray-dark: #222;
    --hacker-gray-darker: rgb(26, 26, 26);
    --hacker-gray-less-dark: rgb(43, 43, 43);
    --hacker-green-dark: rgb(0, 73, 0);
    --hacker-green-gray-light: #c6eec6;
    --hacker-green-gray-lightish: #77d877;
    --hacker-green-gray-darkish: rgb(0, 97, 0);
    --hacker-green-gray-dark: rgb(26, 48, 26);
    --error-red: #ff0048;
    /* Fonts */
    --font-business: system-ui;
    --font-main: Verdana;
    --font-code: consolas;
    /* Sizing */
    --sectionhead-height: 38px;
    --border-thickness-normal: 2px;
}

body, html {
    height: auto;
    margin: 0;
}
body {
    background-color: var(--bg-gray);
}

/* noscript */
noscript, narrowcontent {
    color: white;
    padding: 50px;
    display: block;
    font-size: 30px;
    text-align: center;
}

/* narrow window (PMD, small screen) */
narrowcontent {
    display: none;
}

#narrowcontent-gh-link {
    margin: 50px auto;
    width: 128px;
}

#narrowcontent-gh-mark {
    width: 100%;
}

@media (max-width: 650px) {
    narrowcontent {
        display: block;
    }
    body grid {
        display: none;
    }
}

body, button, td {
    font-family: var(--font-main);
}

.style1, button {
    background-color: var(--hacker-gray-dark);
    color: var(--hacker-green);
    border: var(--border-thickness-normal) var(--hacker-green) solid;
    border-radius: 4px;
}

popup {
    position: fixed;
    padding: 20px;
    text-align: center;
    font-size: 30px;
    left: 35%;
    top: 30%;
    width: 30%;
    background: var(--hacker-gray-dark);
    color: var(--hacker-green);
    border: 4px solid;
    border-radius: 4px;
    box-shadow: 0 0 10px 5px black;
    opacity: 0.97;
}

popupdesc {
    display: block;
    padding: 10px;
    font-size: 16px;
}

popup button {
    display: block;
    margin: 18px auto;
    font-size: 35px;
}

popup cyclescontainer {
    font-size: 20px;
}

input, textarea {
    outline: none;
    text-decoration: none;
    font-family: var(--font-code);
    tab-size: 4;
    -moz-tab-size: 4;
}

textarea {
    resize: none;
}

.num-cycles-input {
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    width: 52px;
    text-align: right;
    padding: 0;
}

#program-title {
    background: none;
    font: inherit;
    color: inherit;
    border: none;
    text-align: center;
    width: 100%;
    height: calc(var(--sectionhead-height) - var(--border-thickness-normal) - var(--border-thickness-normal));
}

.tooltip-parent tooltip {
    visibility: hidden;
    display: block;
    position: absolute;
    background: black;
    color: white;
    font-size: 12px;
    opacity: 0.8;
    cursor: default;
    font-family: var(--font-business);
    z-index: 1000;
    transition-delay: 0;
}

.tooltip-parent:hover tooltip {
    visibility: visible;
    transition-delay: 1s;
}

table {
    list-style: none;
    padding: 8px;
    font-size: 14px;
    width: 100%;
}

table tr td, table tr th {
    margin: 4px;
}

table tr td:first-child {
    width: 100%;
}

/* header / title */

.header {
    width: 100%;
    height: 80px;
    grid-row-start: 1;
    grid-column-start: 1;
    grid-column-end: 4;
}

h1 {
    margin: auto;
    font-size: 40px;
    font-family: "Balsamiq Sans", cursive;
    color: var(--hacker-green-gray-light);
    font-weight: 100;
}

wipsw {
    display: inline-block;
    animation: w-sync 6s linear forwards;
}

@keyframes w-sync {
    /* drop */

    /* stagnant - start */
    from, 38% {
        transform: translate(0, 0) rotate(180deg);
    }
    /* initial shake */
    40%, 60% {
        transform: translate(0, 1px) rotate(176deg);
    }
    /* drop */
    64% {
        transform: translate(-4px, 10px) rotate(160deg);
    }
    /* drop padding */
    66%, 80% {
        transform: translate(-5px, 12px) rotate(150deg);
    }
    /* move to stagnant end */
    90%, to {
        transform: translate(0, 0) rotate(0);
    }

    /* flicker */

    /* on */
    from, 39%, 41%, 44%, 46%, 49%, 51%, 57%, 59%, 85%, to {
        color: inherit;
    }
    /* off */
    40%, 45%, 50%, 58%, 60%, 75% {
        color: var(--hacker-gray);
    }
}

/* grid layout */

grid {
    display: grid;
    gap: 0;
    grid-template-columns: 28% auto 28%;
    grid-template-rows: 8% 63% 18% 18%;
}

griditem {
    display: inline-grid;
    margin: 0;
    padding: 0;
    gap: 0;
}

/* registers */
.left-column {
    grid-column-start: 1;
    grid-row-start: 2;
    grid-row-end: end;
}

/* code */
.center-column-top {
    grid-column-start: 2;
    grid-row-start: 2;
    grid-row-end: 3;
}

/* code */
.center-column-bottom {
    grid-column-start: 2;
    grid-row-start: 3;
    grid-row-end: end;
}

/* console */
.right-column-top {
    grid-column-start: 3;
    grid-row-start: 2;
    grid-row-end: 3;
}

/* Trap */
.right-column-2 {
    grid-column-start: 3;
    grid-row-start: 3;
    grid-row-end: 4;
}

/* Main Memory */
.right-column-3 {
    grid-column-start: 3;
    grid-row-start: 4;
    grid-row-end: 5;
}

/* start content tall in case MIPS initialization for ui has long load time */
#register-box {
    min-height: 900px;
}

/* main mem */

#main-mem-head column {
    display: inline-block;
    margin: 0;
    padding: none;
    width: 30%;
}


#main-mem-head column button {
    padding: 2px;
}

@media (max-width: 1430px) {
    #main-mem-head column {
        width: auto;
    }
    #main-mem-body {
        overflow-x: scroll;
    }
}

#main-mem-body {
    overflow-y: scroll;
}

/* no scrollbar */
#main-mem-body::-webkit-scrollbar {
    display: none;
}

/* right col align right */
#main-mem-table td:nth-child(even) {
    text-align: right;
}

#main-mem-display-binary {
    font-family: var(--font-code);
    height: 24px;
    width: 26px;
    transform: translateY(-2px);
}

/* buttonrow */

buttonrow {
    padding: 0;
    margin: 0 10px;
}

buttonrow button, buttonrow dropdown {
    vertical-align: top;
    display: inline-block;
    width: fit-content;
    font-size: 20px;
    margin: 0;
    padding: 4px;
    margin-bottom: 10px;
}

buttonrow button.icon-parent {
    padding-bottom: 1px;
}

buttonrow dropdown {
    padding: 0;
}

buttonrow dropdown button {
    margin: 0;
}

/* dropdown */

/* hide options */
.dropdown .options {
    display: none;
}

/* show options on focus */
.dropdown:focus .options, .dropdown:focus-within .options {
    display: block;
}

.dropdown .title button, .dropdown .options button {
    border: none;
    width: -webkit-fill-available;
}

.dropdown .options button {
    border-radius: 0;
    border-top: var(--hacker-green) 1px solid;
    display: block;
    text-align: left;
    font-family: var(--font-business);
}

output {
    display: inline-block;
    cursor: default;
}

.erroroutput {
    color: #350000;
    font-size: 20px;
    font-family: var(--font-code);
}

.stateoutput {
    transform: translateY(-10px);
    font-size: 16px;
    color: black;
}

spinner {
    --size: 15px;
    width: var(--size);
    height: var(--size);
    margin: 6px;
    display: inline-block;
    border-radius: 50%;
    border: dotted black;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

button:hover {
    cursor: pointer;
    background-color: var(--hacker-gray-less-dark);
}

.just-contents {
    padding: none;
    margin: none;
    border: none;
    background: none;
}

.hidden {
    display: none;
}

/* Schematic */

schematicbox {
    display: block;
    --margin-size: 10px;
    margin: var(--margin-size);
    max-width: calc(100% - var(--margin-size) - var(--margin-size) - 1px);
    max-height: calc(100% - var(--margin-size) - var(--margin-size) - 1px);
}

#schematic-img {
    width: 100%;
    height: 100%;
    position: relative;
}

#schematic-gh-link {
    width: 0;
    height: 0;
}

.gh-link {
    opacity: 60%;
    display: block;
    border-radius: 50%;
}

.gh-link:hover {
    opacity: 80%;
}

.gh-mark {
    display: block;
    border-radius: 50%;
}

#schematic-gh-mark {
    transform: translateY(-70px);
}

#clear-console {
    border-radius: 50%;
    cursor: pointer;
    float: left;
    margin: 1px 4px;
    width: 0;
}

.programmer-input {
    background: none;
    border: none;
    --padding: 10px;
    padding: var(--padding);
    width: -webkit-fill-available;
    height: calc(100% - var(--padding) - var(--padding));
    font-size: 18px;
    color: var(--hacker-green-gray-light);
}

contentbox {
    background-color: var(--hacker-gray-dark);
    color: var(--hacker-green);
    border: var(--border-thickness-normal) var(--hacker-green) solid;
    border-radius: 4px;
    margin: 10px;
    margin-top: 0;
    overflow: hidden;
}

sectionhead {
    --top-padding: 6px;
    display: block;
    border-bottom: var(--border-thickness-normal) solid;
    padding-top: var(--top-padding);
    min-height: calc(var(--sectionhead-height) - var(--border-thickness-normal) - var(--top-padding));
    font-size: 20px;
    text-align: center;
}

sectionbody {
    display: block;
    height: calc(100% - var(--sectionhead-height));
    overflow: hidden;
}

#registers-section {
    overflow-x: auto;
}

/* Input Arrow Steppers */

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  display: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

/* Scrollbars */

/* body's scrollbar */
body::-webkit-scrollbar {
    width: 14px;
}

/* scrollbar for all elements inside body */
body ::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: var(--hacker-green-gray-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--hacker-green-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hacker-green);
}

::-webkit-scrollbar-corner {
    background: var(--hacker-green-gray-dark);
}