:root {
    --brand-color: #e98cf4;
}

td > input:not(:focus) {
    --bg: transparent;
}

td > input {
    /*width: fit-content;*/
    min-width: 3em;
    min-height: 1.5em;
    /*padding: 0 var(--sp0);*/
}

[popovertarget] {
    cursor: pointer;
}

form [role="alert"] {
    &:not(:empty) {
        display: block;
        font-size: 0.9em;
        color: var(--danger);
        /*background: var(--bg-danger-subtle);*/
        font-weight: 300;
        padding-bottom: var(--sp1);
        opacity: 0.8;
    }

    &:empty {
        opacity: 0;
        height: 0;
    }

    transition: opacity 0.2s,
    height 0.2s;
}

form:invalid [type="submit"] {
    opacity: 0.5;
    pointer-events: none;
}

form:valid [type="submit"] {
    opacity: 1;
    pointer-events: auto;
}

#flash-messages {
    position: fixed;
    top: 0;
    right: 0;
    padding: var(--sp2);
    display: grid;
    gap: var(--sp1);
    z-index: 1000;
}

[contenteditable="true"] {
    outline: none;
    padding-top: var(--sp0);
    line-height: 1.4;
    min-height: 6em;
    min-width: 40em;
    max-width: 80vh;

    li {
        display: list-item;
    }
}

[contenteditable="true"]:empty:before {
    content: attr(placeholder);
    color: var(--light);
}

.logo {
    height: 2em;
}

.center {
    margin: auto;
    font-size: 1.2em;
    text-align: center;
    color: var(--subtle);
}

#profile-settings-btn {
    border-radius: 99px;
}

/*[role=toolbar] + [contenteditable=true]:focus {*/
/*    visibility: visible;*/
/*}*/

/*[role=toolbar] + [contenteditable=true] {*/
/*    visibility: hidden;*/
/*}*/

.health-bar button {
    display: inline-block;
    width: .7em;
    min-block-size: 1em;
    padding: 0 .1em;
    margin: 0;
    interest-delay: .2s .5s;
    background: var(--bg);
    transition: all .2s ease-in-out;

    &:hover {
        box-shadow: inset 0 -1px 99px 0 rgba(0, 0, 0, .2);
    }
}

.health-bar [popover] {
    animation: unset;
}

.health-bar button.FINISHED {
    --bg: var(--bg-green);
}

.health-bar button.ERROR {
    --bg: var(--bg-red);
}

.health-bar button.PENDING {
    --bg: var(--subtle);
}


#loginForm {
    width: fit-content;
    /*text-align: center;*/
    margin: 20vh auto;
    transition: margin 0.3s;

    & > svg {
        align-self: center;
        height: 1.8em;
    }

    [type=submit] {
        transition: all .3s ease-in-out;
    }

    [name="password"] {
        transition: all .3s ease-in-out;
    }
}

#loginForm:invalid {
    [type=submit] {
        opacity: 0;
    }
}

#loginForm:has([name="username"]:invalid) {
    [name="password"] {
        opacity: 0;
    }
}

[data-saved="true"] {
    transition: background-color 0.3s;
    background-color: var(--bg-success-subtle) !important;
}