.demo-container {
    display: grid;
    grid-template-columns: [aside-start] 1fr [aside-end content-start] 1fr 1fr [content-end];
    grid-gap: 3em;
    margin: 0 auto;
}

.demo-aside { grid-column: aside; }
.demo-content { grid-column: content; }

.demo {
    position: relative;
    display: flex;
    --rs: 20px;
    --gap: 10px;
    --letterlink: var(--gap);
    --bg: #f5edc8;
    --gray: #79787273;
    width: calc(300px + (2 * var(--rs)));
    height: calc(300px + (2 * var(--rs)));
    max-width: 100%;
    background: var(--bg);
    padding: var(--rs);
    margin: .5em 0;
    border-radius: var(--rs);
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
}

.demo-text {
    display: none;
    line-height: 1.3;
}
.hl-r { color: rgb(197, 64, 64); font-weight: bold; }
.hl-b { color: rgb(42, 60, 216); font-weight: bold; }
.hl-g { color: green; font-weight: bold; }
.hl-gr { color: var(--gray);}

.demo-add_sym {
    margin-bottom: 3em;
}
.demo-add_sym input[type="text"] {
    font-size: 20px;
    padding: .25em;
    outline: none;
    border: 1px solid var(--input-bd);
    background-clip: padding-box;
}
.demo-add_sym-sym {
    width: 1.5em;
    text-align: center;
}
.demo-add_sym-sym:not(:valid) ~ .demo-add_sym-submit {
    color: var(--input-bd);
}
.demo-add_sym-error {
    color: rgb(197, 64, 64);
}

.demo-syms-container {
    margin-bottom: 3em;
}

.demo-syms-title {
    display: flex;
    align-items: baseline;
    margin-right: -1rem;
    flex-wrap: wrap;
}
.demo-syms-title h4 {
    flex-basis: 100%;
}
.demo-syms-title > * { margin-right: 1rem; }

.share-link {
    display: none;
    position: relative;
    width: 40%;
    min-width: 280px;
    margin: .5em 0 .5em auto;
    background: rgba(127,127,127,.1);
    padding: .5em;
    line-height: 1;
    border-radius: 2px;
    white-space: nowrap;
}
.share-link-input {
    background: none;
    border: none;
    outline: none;
    padding: 0.5em;
    margin: -0.5em 0;
    width: 100%;
    padding-right: 100px;
    margin-right: -80px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
.share-link-btn {
    position: absolute;
    right: .35em;
    margin-top: -.2em;
}

.demo-syms-placeholder {
    display: none;
    color: var(--gray);
}
.demo-syms-placeholder::before { content: '← '; }
.demo-syms-placeholder:last-child { display: block; }

.demo-syms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(4em, 1fr));
    grid-gap: 1em;
    width: 100%;
    padding: 0;
    list-style-type: none;
    font-family: monospace;
}
.demo-syms li {
    position: relative;
    line-height: 1.5;
    padding-left: 1em;
}
.demo-syms .sym {
    --gap: 3px;
    --letterlink: var(--gap);
    --rs: .5em;
    height: 57px;
    cursor: pointer;
}
.demo-sym-remove {
    position: absolute;
    display: none;
    width: .6em;
    text-align: right;
    color: rgb(223, 130, 134);
    left: 0;
    top: 0;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}
.demo-sym-remove:hover { color: var(--link-h);}
.demo-syms li:hover .demo-sym-remove {display: block;}
.demo-sym-remove.modal-sym-remove {display: block;}


.demo-sym-sym {
    position: absolute;
    width: .6em;
    text-align: right;
    color: var(--gray);
    left: 0;
    bottom: -1px;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
}

.add-col-btn
, .remove-col-btn
{
    position: absolute;
    display: inline-block;
    line-height: 1;
    padding: .25em;
    color: var(--gray);
    cursor: pointer;
    transform: translate(-50%, -50%);
}
.add-col-btn:hover
, .remove-col-btn:hover
{ color: var(--link-h); }
.add-col-btn {
    right: -0.9em;
    top: 50%;
}
.remove-col-btn {
    bottom: -2.2em;
    left: 50%;
}

.demo-col {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-grow: 1;
}
.demo-cell {
    position: relative;
    --demo-bg: transparent;
    height: calc((100% - var(--gap)) / 6);
    margin: calc(-1 * var(--gap));
    margin: var(--gap);
    background: var(--demo-bg);
    border: 1px dashed var(--gray);
    cursor: pointer;
}
.demo-cell.active::before {
    content: '';
    display: block;
    text-align: center;
    border: 1px dashed var(--gray);
    position: absolute;
    width: 40%;
    height: 30%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.demo-cell.active {
    --demo-bg: var(--cell-bg);
    border: none;
}
.demo-cell > div:hover {
    --gray: var(--link-h);
    cursor: pointer;
}
.demo-rs_tl
, .demo-rs_tr
, .demo-rs_bl
, .demo-rs_br
{
    display: none;
    width: var(--gap);
    height: var(--gap);
    position: absolute;
    border: calc(var(--gap)/2) solid var(--bg);
}
.demo-rs_tl { top: 0; left: 0; }
.demo-rs_tr { top: 0; right: 0; }
.demo-rs_bl { bottom: 0; left: 0; }
.demo-rs_br { bottom: 0; right: 0; }
.demo-rs_tl { border-bottom-color: transparent; border-right-color: transparent; }
.demo-rs_bl { border-top-color: transparent; border-right-color: transparent; }
.demo-rs_tr { border-bottom-color: transparent; border-left-color: transparent; }
.demo-rs_br { border-top-color: transparent; border-left-color: transparent; }
.demo-rs_tl::before
, .demo-rs_tr::before
, .demo-rs_bl::before
, .demo-rs_br::before
{
    content: '•';
    display: block;
    text-align: center;
    color: var(--gray);
    width: var(--gap);
    transform: translate(-50%, -50%);
}
.demo-cell.active .demo-rs_tl
, .demo-cell.active .demo-rs_tr
, .demo-cell.active .demo-rs_bl
, .demo-cell.active .demo-rs_br
{ display: block; }
.demo-rs_tl:not(.inactive)
, .demo-rs_tr:not(.inactive)
, .demo-rs_bl:not(.inactive)
, .demo-rs_br:not(.inactive)
{ --bg: transparent; }
.demo-cell.first-chain-cell .demo-rs_bl
, .demo-cell.first-chain-cell .demo-rs_br
, .demo-cell.chain-cell .demo-rs_tl
, .demo-cell.chain-cell .demo-rs_tr
, .demo-cell.chain-cell .demo-rs_bl
, .demo-cell.chain-cell .demo-rs_br
, .demo-cell.last-chain-cell .demo-rs_tl
, .demo-cell.last-chain-cell .demo-rs_tr
{ display: none; }


.demo-d_tl
, .demo-d_tr
, .demo-d_bl
, .demo-d_br
{
    display: none;
    width: calc(2* var(--gap));
    height: var(--gap);
    position: absolute;
    background: var(--demo-bg);
    z-index: 1;
}
.demo-d_tl { top: 0; left: calc(-2 * var(--gap)); }
.demo-d_tr { top: 0; right: calc(-2 * var(--gap)); }
.demo-d_bl { bottom: 0; left: calc(-2 * var(--gap)); }
.demo-d_br { bottom: 0; right: calc(-2 * var(--gap)); }
.demo-d_tl::before
, .demo-d_tr::before
, .demo-d_bl::before
, .demo-d_br::before
{
    content: '•';
    position: absolute;
    display: inline-block;
    z-index: 100;
    width: var(--gap);
    color: var(--gray);
    line-height: var(--gap);
}
.demo-d_tl::before
, .demo-d_bl::before
{ text-align: right; margin-left: var(--gap); }
.demo-cell.active .demo-d_tl
, .demo-cell.active .demo-d_tr
, .demo-cell.active .demo-d_bl
, .demo-cell.active .demo-d_br
{ display: block; }
.demo-d_tl:not(.active)
, .demo-d_tr:not(.active)
, .demo-d_bl:not(.active)
, .demo-d_br:not(.active)
{ --demo-bg: transparent; }
.demo-cell.first-chain-cell .demo-d_bl
, .demo-cell.first-chain-cell .demo-d_br
, .demo-cell.chain-cell .demo-d_tl
, .demo-cell.chain-cell .demo-d_tr
, .demo-cell.chain-cell .demo-d_bl
, .demo-cell.chain-cell .demo-d_br
, .demo-cell.last-chain-cell .demo-d_tl
, .demo-cell.last-chain-cell .demo-d_tr
{ display: none; }

.demo-link {
    position: absolute;
    display: none;
    bottom: calc(-2 * var(--gap));
    height: calc(2 * var(--gap));
    width: 100%;
    --demo-bg: transparent;
    background: var(--demo-bg);
}
.demo-link::before {
    content: '—';
    display: block;
    text-align: center;
    color: var(--gray);
}
.demo-link.linked {
    --demo-bg: var(--cell-bg);
}
.demo-cell.active.linkable .demo-link {
    display: block;
}
.demo-cell:not(.active) .demo-link.linked {
    --demo-bg: transparent;
}
.demo-cell:last-of-type .demo-link {
    display: none;
}

/*
demo-d_tl
demo-d_tr
demo-d_bl
demo-d_br
demo-rs_tl
demo-rs_tr
demo-rs_bl
demo-rs_br
demo-link
*/

.footer-likely {
    grid-column: 1 / 3;
    display: flex;
    flex-direction: column;
}
.footer-text { grid-column: 3; }

div.likely {
    display: block;
    margin-bottom: 1em;
    flex-grow: 1;
}


body.modal-lock {
    overflow: hidden;
    background-color: var(--gray);
}
.modal-wrapper {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: auto;
}
.modal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    width: 90vw;
    max-width: 920px;
    margin: 4em auto 6em;
    padding: 4em 6em 6em 5em;
    background: var(--bg);
    outline: none;
    user-select: auto;
}
.modal-footer {
    padding: 1em;
}
.modal-footer button {
    margin: 0 0.5em;
}
body.modal-lock main
, body.modal-lock article
, body.modal-lock footer
{ filter: opacity(.5) contrast(.5) grayscale(1); }


@media screen and (max-width: 920px) {
    .demo-container { display: block; }
    .demo-syms-placeholder::before { content: '↑ '; }
    .modal { padding: 1em 1em 3em 2em; }
    .demo-sym-remove { display: block; }
}

.buy-coffee-link {
    position: relative;
    padding: 0.23em 0.5em 0.27em;
    background-color: #ffdd00;
    border-radius: 1em;
    line-height: 0.8;
    white-space: nowrap;
}
.buy-coffee-link:not(:hover):not(:active) {
    /* color: var(--text); */
}