:root {
    --form-control-color: rgb(55, 0, 143);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    padding: 0;
    margin: 0;
}

main {
    display: flex;
    gap: 1em;
}

aside {
    padding: 1em 2em;
    top: 0;
    min-height: 100vh;
    box-sizing: border-box;
    background-color: var(--form-control-color);
    color: white;
    min-width: 26em;
}

aside, #aside-main {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

#aside-main {
    padding-bottom: 1em;
}

aside a,
aside a:hover {
    color: white;
}

aside pre {
    max-width: 24em;
    max-height: 15.7em;
    font-size: 80%;
    overflow: auto;
    user-select: all;
}

aside p {
    font-size: 90%;
    max-width: 24em;
}

aside details {
    margin-top: 0.5em;
}

aside button {
    padding: 1em;
    max-width: 25em;
    border: 2px solid var(--form-control-color);
    background-color: var(--form-control-color);
    color: white;
    border-radius: 10px;
    box-shadow: inset 0 0 5px #ccc;
    cursor: pointer;
}

aside input[type="text"] {
    padding: 1em;
    border: 2px solid var(--form-control-color);
    border-radius: 10px;
}

aside button:active {
    transform: scale(0.98);
    background-color: rgb(98, 46, 182);
}

aside button:disabled {
    background-color: rgb(87, 71, 112);
    box-shadow: inset 0 0 5px #333;
    color: #bbb;
    cursor: not-allowed;
}

aside button#random-button {
    background-color: rgb(132, 24, 179);
}

#hint-layout > div {
    display: grid;
    grid-template-columns: 1fr 10ex;
    padding: 1em;
    row-gap: .5em;
}

#hint-layout label {
    text-align: right;
    padding-right: 1em;
}

section {
    padding: 2em 2em 0 2.5em;
    display: flex;
    flex-direction: column;
    order: 2;
    align-items: flex-start;
    justify-content: flex-start;
}

#hello-message {
    background-color: white;
    min-width: 200px;
    max-width: 400px;
    padding: 0 1em;
    margin-top: 50px;
    border: 1px solid var(--form-control-color);
    border-radius: 10px;
    position: relative;
}

#hello-message > #hello-expand {
    display: none;
}

#hello-message.hello-closed {
    display: block;
    min-width: unset;
    position: fixed;
    right: -10px;
    top: 50px;
    padding: 12px;
}

#hello-message.hello-closed > #hello-expand {
    display: block;
}

#hello-message.hello-closed > * {
    display: none;
}

#hello-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-weight: bold;
    font-size: 25px;
    color: #999;
}

#hello-expand {
    font-weight: bold;
    font-size: 25px;
    color: #999;
}

#start-tour {
    text-decoration: underline;
    color: #953b39;
    cursor: pointer;
}

aside #credits {
    margin-top: auto;
}

div#input-table-spacer {
    min-height: 300px;
    min-width: 400px;
    margin-bottom: 1em;
    margin-right: 2em;
}

#input-table-wrapper {
    display: inline-block;
}

#input-table {
    border-collapse: collapse;
}

#input-table th, #input-table thead td {
    font-weight: bold;
}

#input-table td {
    text-align: center;
    font-size: 1.5em;
}

table td.row-title {
    color: #999;
}

.dragged-row-source, .dragged-col-source {
    background-color: #CCC;
}

.dragged-row-target-before td {
    border-top: 2px solid var(--form-control-color);
    padding-top: 5px;
}

.dragged-row-target-after td {
    border-bottom: 2px solid var(--form-control-color);
}

tr.dragged-row-target-after + tr td {
    padding-top: 5px;
}

td.dragged-col-target-before {
    border-left: 2px solid var(--form-control-color);
    padding-left: 1px;
}

td.dragged-col-target-after {
    border-right: 2px solid var(--form-control-color);
}

td.dragged-col-target-after + td {
    padding-left: 1px;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: white;
    margin: 0;

    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 0.15em solid currentColor;
    border-radius: 0.15em;
    transform: translateY(-0.075em);

    cursor: pointer;

    display: grid;
    place-content: center;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    /* clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); */
    transform: scale(0);
    /* transform-origin: bottom left;
    transition: 120ms transform ease-in-out; */
    box-shadow: inset 1em 1em var(--form-control-color);
    /* Windows High Contrast Mode */
    background-color: CanvasText;
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]#toggle-cyclic {
    display: inline-grid;
}

input[type="checkbox"].highlight, tr.highlight input[type="checkbox"] {
    border-color: rgb(9, 57, 154);
    box-shadow: inset 0 0 3px rgb(11, 97, 209);
}

input[type="checkbox"].highlight::before, tr.highlight input[type="checkbox"]::before {
    box-shadow: inset 1em 1em rgb(11, 97, 209);
}

input[type="checkbox"].error, tr.error input[type="checkbox"] {
    border-color: rgb(154, 24, 9);
    box-shadow: inset 0 0 3px rgb(209, 11, 11);
}

input[type="checkbox"].error::before, tr.error input[type="checkbox"]::before {
    box-shadow: inset 1em 1em rgb(209, 11, 11);
}

input[type="checkbox"].error-after, tr.error-after input[type="checkbox"] {
    border-color: rgb(115, 36, 27);
    box-shadow: inset 0 0 3px rgb(143, 31, 31);
}

input[type="checkbox"].error-after::before, tr.error-after input[type="checkbox"]::before {
    box-shadow: inset 1em 1em rgb(143, 31, 31);
}

#add-row-cell, #add-col-cell {
    transition: all .1s linear;
}

.table-dragging-row #add-row-cell, .table-dragging-col #add-col-cell {
    transform: rotate(-45deg) scale(1.5);
    display: inline-block;
    font-weight: bold;
    color: red;
}

.del-btn-hover {
    color: #953b39 !important;
}

td a {
    font-weight: bold;
}

tfoot a {
    margin-top: -5px;
    padding-top: -5px;
}

a:hover {
    color: rgb(85, 39, 160);
    cursor: pointer;
}

#svg-container {
    border: 2px solid var(--form-control-color);
    border-radius: 10px;
    padding: 15px 5px;
    box-shadow: 5px 5px 5px #ccc;
    max-width: 100%;
    height: auto;
    position: relative;
}

#svg-container text {
    pointer-events: none;
    user-select: none;
}

#svg-container polygon:hover,
#svg-container circle:hover,
#svg-container rect:hover {
    cursor: pointer;
    fill: rgb(202, 184, 232);
}

summary {
    cursor: pointer;
    user-select: none;
}

.tg-backdrop {
    pointer-events: none;
}

#tg-dialog-body img {
    padding: 15px 25px;
    box-sizing: border-box;
}

#tg-dialog-body {
    overflow: scroll;
    max-height: calc(90vh - 100px);
    mask-image: linear-gradient(to bottom, black calc(100% - 24px), transparent 100%);
}

body.rotated #input-table-container {
    transform: rotate(-90deg) translate(-100%, 0);
    transform-origin: top left;
}

body.rotated #input-table-container thead td {
    transform: rotate(90deg);
}

@media screen and (max-width: 1024px) {
    aside {
        min-width: 22em;
        width: 22em;
        gap: 0.5em;
    }

    section#input-wrapper {
        padding: 1em;
    }
}

@media screen and (max-width: 768px) {
    aside {
        min-width: 17em;
        width: 17em;
        gap: 0.3em;
    }

    section#input-wrapper {
        padding: 1em;
    }
}

h1 svg {
    height: 1em;
    margin-bottom: -3px;
}

@media screen and (max-width: 600px) {
    main {
        flex-direction: column;
        gap: 0;
    }

    aside {
        min-width: 100%;
        gap: 0.5em;
        padding: 1em;
        padding-bottom: 0;
        height: auto;
        box-shadow: 0px 3px 3px #ccc;
    }

    aside h1 {
        font-size: 120%;
        margin: 0;
    }

    aside #credits {
        margin-top: 0.2em;
        font-size: 75%;
    }

    section#input-wrapper {
        padding: 0 0.5em;
    }

    aside button {
        width: 100%;
        max-width: 100%;
    }

    div#input-table-container {
        min-height: 0;
        margin-bottom: 1.5em;
    }

    #hint-paste,
    #hint-export,
    #copy-button {
        display: none;
    }
}
