:root {
    --primary-color: #797f8e;
    --primary-dark-color: #555b69;
    --secondary-color: #242c37;
    --secondary-dark-color: #1d242d;
    --primary-action-color: #4fe4c1;
    --primary-action-dark-color: #10755d;
    --secondary-action-color: #fac372;
}

* {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    display: grid;
    align-items: center;
    height: 100%;
    color: var(--primary-color);
    background-color: var(--secondary-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
        sans-serif;
    font-size: 0.8rem;
}

h1 {
    margin: 0 0 0.2rem 0;
    color: var(--primary-action-color);
    font-size: 2rem;
}

h2 {
    margin: 0 0 1.8rem 0;
    font-size: 0.9rem;
    font-weight: 300;
}

hr {
    border: none;
    border-bottom: solid 1px #555b69;
    margin: 0.2rem 0;
}

.section {
    padding: 1rem;
}

.parent {
    height: 100%;
    display: grid;
    grid-template: auto 1fr auto / auto 1fr auto;
    overflow: hidden;
}

.left-panel {
    overflow: auto;
    width: 17rem;
    grid-column: 1 / 2;
    background-color: var(--secondary-color);
    border-right: solid 1px var(--primary-dark-color);
    box-shadow: 1px 1px 5px black;
    z-index: 100;
}

main {
    grid-column: 2 / 3;
    overflow: auto;
}

canvas {
    border: solid 0.1rem var(--primary-action-color);
    border-radius: 1rem;
    margin-top: 0.5rem;
    box-shadow: 1px 1px 5px black;
}

.canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
}

label {
    margin-right: 0.5rem;
}

.label {
    display: inline-block;
    width: 8.7rem;
    text-align: end;
}

.unit {
    margin: 0;
}

button {
    border: none;
    letter-spacing: 0.25rem;
    cursor: pointer;
    background-color: var(--primary-action-color);
    border-radius: 50px;
    color: var(--secondary-color);
    width: 6rem;
    margin: 0.5rem 0;
    padding: 0.5rem;
}

button:hover {
    background-color: var(--primary-color);
}

button:active {
    background-color: var(--secondary-action-color);
}

/*
** Remove Arrows/Spinners from input[type="number"]
*/

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

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

/*
**
*/

[type='radio']:checked,
[type='radio']:not(:checked) {
    display: none;
}

[type='radio']:checked + label,
[type='radio']:not(:checked) + label {
    position: relative;
    padding-left: 1.5rem;
    cursor: pointer;
    line-height: 1rem;
    display: inline-block;
    color: var(--primary-color);
}

[type='radio']:checked + label:before,
[type='radio']:not(:checked) + label:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 15px;
    height: 15px;
    border: 1px solid var(--primary-action-color);
    border-radius: 100%;
}

[type='radio']:checked + label:before {
    background: var(--primary-action-dark-color);
}

[type='radio']:not(:checked) + label:before {
    background: var(--primary-dark-color);
}

[type='radio']:checked + label:after,
[type='radio']:not(:checked) + label:after {
    content: '';
    width: 9px;
    height: 9px;
    background: var(--primary-action-color);
    position: absolute;
    top: 4px;
    left: 4px;
    border-radius: 100%;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

[type='radio']:not(:checked) + label:after {
    opacity: 0;
    -webkit-transform: scale(0);
    transform: scale(0);
}

[type='radio']:checked + label:after {
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1);
}

input[type='number'] {
    border: solid 1px var(--primary-action-color);
    outline: none;
    background-color: var(--primary-action-dark-color);
    border-radius: 50px;
    padding: 0.2rem 0.5rem;
    color: var(--primary-action-color);
    width: 3.5rem;
    margin: 0.3rem;
}

.horizontal-spacer {
    margin: 0 1rem;
}

.main {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.input {
    margin: 0.5rem;
}

.buttons {
    text-align: end;
    margin: 0.3rem 1rem;
    padding-right: 0.5rem;
}

.radio-button {
    display: flex;
    align-items: center;
    margin: 0.5rem 0rem 0.5rem 1.3rem;
}

.engine {
    display: flex;
    margin: 0 0.5rem;
    justify-content: end;
}

.throttle {
    margin-top: 1.2rem;
}

.throttle-labels {
    display: flex;
    align-items: baseline;
    justify-content: center;
    width: 100%;
}

.throttle-value {
    font-size: 1rem;
    margin-left: 0.2rem;
    width: 2.7rem;
    text-align: end;
}

.throttle-milliseconds {
    margin-left: 0.2rem;
}

footer {
    grid-column: 1 / 4;
    border-top: solid 1px var(--primary-dark-color);
    box-shadow: 1px 1px 5px black;
    background-color: var(--secondary-dark-color);
    padding: 0.5rem !important;
    text-align: end;
    z-index: 200;
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.version {
    margin: 0.5rem;
    font-size: 1rem;
    letter-spacing: 0.1rem;
    color: var(--primary-dark-color);
}

.svg {
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
}

.svg:hover {
    background-color: var(--primary-dark-color);
}

.svg:active {
    background-color: var(--secondary-action-color);
}

.library {
    left: 6.6rem;
    top: 0.5rem;
    transition: 0.3s ease-in-out;
}

.library.open {
    transform: translate(11.5rem);
}

.library-panel {
    margin: 1.3rem 0 0.7rem 0;
}

.library-list {
    height: 14.5rem;
    overflow: overlay;
    border: solid 1px var(--primary-dark-color);
    border-radius: 0.5rem;
    box-shadow: rgb(0 0 0 / 15%) 0px 0px 4px 3px inset,
        rgb(0 0 0 / 15%) 0px 0px 1px 2px inset;
}

.library-item {
    color: var(--primary-color);
    list-style: none;
    padding: 0.3rem 0.5rem 0.6rem 0.5rem;
    width: 8rem;
    border-bottom: solid 1px var(--primary-dark-color);
}

.library-item:hover {
    background-color: var(--primary-dark-color);
}

.library-rle {
    width: 4rem;
    font-size: 0.7rem;
    margin: 0.3rem 0 0.8rem 0;
    padding: 0.3rem 0;
}

.rle-panel {
    position: fixed;
    bottom: -10rem;
    border-radius: 0.7rem;
    background-color: var(--secondary-color);
    border: solid 0.15rem var(--primary-action-color);
    box-shadow: 1px 1px 5px black;
    padding: 0.5rem 0.5rem 1rem 0.5rem;
    transition: 0.3s ease-in-out;
}

.rle-panel.open {
    bottom: 15.5rem;
    transform: translateY(10rem);
}

.rle-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rle-text {
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: 0.4rem;
    background-color: var(--primary-action-dark-color);
    resize: none;
    color: var(--primary-action-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
        sans-serif;
    outline: none;
    box-shadow: rgb(0 0 0 / 15%) 0px 0px 4px 3px inset,
        rgb(0 0 0 / 15%) 0px 0px 1px 2px inset;
}

.rle-button,
.rle-button-outline {
    width: 5.8rem;
    font-size: 0.7rem;
    letter-spacing: 0.2rem;
    margin: 0.8rem 0.7rem;
    padding: 0.4rem 0;
}

.rle-button-outline {
    background-color: initial;
    color: var(--primary-action-color);
    border: solid 0.1rem var(--primary-action-color);
}

.rle-error {
    font-size: 0.9rem;
    margin: 0.5rem 0.6rem 1rem 0.2rem;
    height: 1rem;
}

.rle-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem;
    border: solid 0.1rem var(--primary-action-color);
    border-radius: 100%;
}

.rle-arrow {
    padding: 0.1rem;
    border-radius: 0.3rem;
}

.rle-arrow:hover {
    background-color: var(--primary-color);
}

.rle-arrow:active {
    background-color: var(--secondary-action-color);
}

.rle-arrow.up {
    transform: rotate(180deg);
    margin-bottom: 0.3rem;
}

.rle-arrow.left {
    transform: rotate(90deg);
    margin-right: 0.3rem;
}

.rle-arrow.right {
    transform: rotate(-90deg);
    margin-left: 0.3rem;
}

.rle-arrow.down {
    margin-top: 0.3rem;
}

.rle-arrows-middle {
    display: flex;
}

.benchmarks {
    left: 0.7rem;
    top: 20.6rem;
    transition: 0.35s ease-in-out;
}

.benchmarks.open {
    transform: translate(17.5rem);
}

.benchmarks-content {
    width: 15rem;
    margin-top: 0.8rem;
}

.benchmark {
    display: flex;
    justify-content: space-between;
    margin: 0.6rem 0;
}

.benchmark-value {
    color: var(--primary-action-color);
}

.benchmark-duration {
    font-family: 'Roboto Mono', monospace;
}

.benchmark-automatic-open-label {
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.info-container {
    position: fixed;
    bottom: 5.5rem;
    right: 1rem;
    color: var(--primary-action-color);
    display: flex;
    font-size: 1rem;
}

.border-right {
    margin: 0 0.5rem;
    border-right: solid 1px var(--primary-color);
}

.colony-sample {
    text-transform: lowercase;
}

.font-monospace {
    font-family: 'Roboto Mono', monospace;
    font-weight: 300;
    font-size: 0.9rem;
}

.generations-label {
    margin-left: 0.3rem;
}

.fps-counter {
    margin-right: 0.3rem;
}

/*
** Components
*/

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 0.1rem;
    background: var(--primary-action-color);
    outline: none;
    margin: 1.5rem 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--secondary-color);
    border: solid 0.15rem var(--primary-action-color);
    cursor: pointer;
}

.slider::-webkit-slider-thumb:hover {
    border: solid 0.2rem var(--primary-action-color);
}

.toggle-container {
    display: flex;
    align-items: center;
    margin: 2rem 0 1rem 0;
}

.toggle {
    display: none;
}

.toggle-background {
    background-color: var(--primary-dark-color);
    border-radius: 50px;
    display: inline-block;
    width: 3.5rem;
    height: 1.7rem;
    position: relative;
    border: 0.1rem solid var(--primary-action-color);
    cursor: pointer;
}

.toggle:checked + .toggle-background {
    background-color: var(--primary-action-dark-color);
}

.ball {
    background: var(--primary-action-color);
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 50%;
    position: absolute;
    top: 0.1rem;
    left: 0.1rem;
    align-items: center;
    justify-content: center;
    animation: slideOff 0.15s linear forwards;
}

.toggle:checked + .toggle-background .ball {
    animation: slideOn 0.15s linear forwards;
}

@keyframes slideOn {
    0% {
        transform: translateX(0) scale(1);
    }
    50% {
        transform: translateX(1.5rem) scale(1.2);
    }
    100% {
        transform: translateX(1.75rem) scale(1);
    }
}

@keyframes slideOff {
    0% {
        transform: translateX(1.75rem) scale(1);
    }
    50% {
        transform: translateX(1.5rem) scale(1.2);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

.sliding-panel {
    display: flex;
    align-items: center;
    position: fixed;
    padding-left: 2rem;
    cursor: pointer;
    border: solid 1px var(--primary-dark-color);
    border-left: none;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    box-shadow: 1px 1px 5px black;
    background-color: var(--secondary-color);
}

.sliding-panel-label {
    font-size: 0.8rem;
    margin: 0 0.6rem 0 2rem;
    writing-mode: tb-rl;
    letter-spacing: 0.3rem;
}

.sliding-panel:hover > .sliding-panel-label {
    color: var(--primary-action-color);
}

.sliding-panel:active > .sliding-panel-label {
    color: var(--secondary-action-color);
}
