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

#textInput {
    width: calc(100% - 20px);
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: max-content;
    grid-row-gap: 5px;
    grid-column-gap: 1em;
    align-items: center;
    margin-bottom: 2em;
}

select, button, textarea {
    padding: 5px 10px;
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: background 0.3s;
}

select, button {
    cursor: pointer;
}

button.mini {
    font-family: serif;
    background: none;
    border: none;
    width: 1.5em;
    padding-left: 4px;
    border-radius: 4px;
}

button:hover {
    background-color: #ddd;
}

label {
    white-space: nowrap;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal img, .modal .modal-edit {
    display: none;
}

.modal.edit img {
    display: inline;
}

.modal.edit .modal-edit {
    display: block;
}

.modal.edit .modal-add {
    display: none;
}

.modal-content {
    background: white;
    padding: 1em;
    max-width: 400px;
    margin: 10% auto;
    border-radius: 5px;
}

.modal-content input, .modal-content select, .modal-content button, .modal-content textarea {
    display: block;
    width: 100%;
    margin-bottom: 0.5em;
}

.modal.active {
    display: block;
}

@media screen and (min-width: 450px) {
    body {
        padding: 15px;
    }

    #textInput {
        width: calc(100% - 30px);
    }

    .form-grid {
        grid-template-columns: max-content max-content;
    }
}

@media screen and (min-width: 660px) {
    body {
        padding: 20px;
    }

    #textInput {
        width: calc(100% - 40px);
    }
}