#characters {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.characterToolbar {
    border: 1px solid var(--toolbar-border-color);
    margin: 16px;
    padding: 16px;
    background-color: var(--toolbar-background-color);
    display: flex;
}

.characterFilters {
    flex-wrap: wrap;
}

.characterFilters select {
    margin-right: 1em;
}

.characterList {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: start;
    overflow: auto;
    padding-bottom: 128px;
    margin-top: -1em;
}

.portrait {
    min-width: 256px;
    min-height: 256px;
    max-height: 256px;
    overflow: hidden;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 4px solid var(--tile-border-color);
    margin: 0px 10px 20px 0px;
    background-color: var(--tile-background-color);
}

.portrait.small {
    border: 1px solid var(--tile-border-color);
    min-width: 64px;
    min-height: 64px;
    max-height: 64px;
    border-radius: 16px;
}

.portrait.tiny {
    border: none;
    min-width: 24px;
    min-height: 24px;
    max-height: 24px;
    margin: 0px;
    padding: 0px;
}

.portraitName {
    padding-bottom: 10px;
    min-height: 246px;
    max-height: 246px;
    text-align: right;
    vertical-align: middle;
    font-size: 1.7em;
    background: var(--name-background-color);
    color: var(--name-color);
    cursor: pointer;
    border: 4px solid var(--name-border);
    transform: rotate(180deg);
    writing-mode: vertical-rl;
    margin-left: 10px
}

.portraitNameVisible {
    min-width: 256px;
    min-height: 256px;
    max-height: 256px;
    margin-top: 8px;
    margin-left: -272px;
    text-align: center;
    vertical-align: middle;
    font-size: 2em;
    background: var(--name-background-color);
    color: var(--name-color);
    text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue;
    cursor: pointer;
    border: 4px solid var(--name-border);
}

.portraitContainer {
    display: flex;
}

.characterSheet {
    width: 90%;
    height: 90vh;
    display: flex;
    background: var(--popup-background-color);
    border: 8px solid var(--popup-border-color);
    color: var(--popup-color);
    overflow: auto;
    z-index: var(--popup-layer);
}

.characterSheetButtonSection {
    display: flex;
    flex-direction: row;
    padding-top: 0 !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    margin-right: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 0 !important;
    font-size: 0.9em;
}

.characterSheetButtonSection button {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    height: 2em;
}

.characterSheet .label {
    font-weight: bold;
}

.characterSheet input {
    padding: 0;
    width: auto;
}

.characterSheet .value {
    border-bottom: 1px solid var(--popup-border-color);
    min-height: 1em;
}

.characterSheet .section {
    margin: 0.5em;
    padding: 0.5em;
    overflow-y: auto;
}

.characterSheet .section.label {
    text-align: center;
    border: 0px;
    padding: 0;
}

.characterSheet .section.label.below {
    margin-top: -0.6em;
}

.characterSheet .section.label.above {
    margin-bottom: -0.6em;
}

.characterSheet .column {
    display: flex;
    flex-direction: column;
}

.characterSheet .column_1 {
    flex-basis: 20%;
}

.characterSheet .column_2 {
    flex-basis: 20%;
}

.characterSheet .column_3 {
    flex-basis: 20%;
}

.characterSheet .column_4 {
    flex-basis: 40%;
}

.characterSheet .section.backstory {
    border: 2px solid var(--section-border-color);
    background-color: var(--popup-background-color);
    padding: 0.5em;
    flex: auto;
}

.characterSheet .section.variants {
    border: 2px solid var(--section-border-color);
    background-color: var(--popup-background-color);
    padding: 0.5em;
    flex: auto;
    overflow-y: auto;
}

.characterVariantButton {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    height: 2em;
}

.characterSheet .section.info {
    background-color: var(--section-background-color);
}

.characterSheet .section.personality {
    border: 2px solid var(--section-border-color);
    background-color: var(--popup-background-color);
}

.characterSheet .favorites.section {
     border-top: 2px solid var(--section-border-color);
}

.characterSheet .label.flag {
    text-align: center;
}

.characterSheet .section.flag {
    margin: 0;
    padding: 0;
}

.characterSheet .flags {
    display: flex;
    max-width: 220px;
    min-width: 220px;
    flex-wrap: wrap;
}

.characterSheet .flagImage {
    min-width: 100px;
    max-width: 100px;
    min-height: 50px;
    max-height: 50px;
    margin-right: 4px;
    margin-left: 4px;

    background-repeat: no-repeat;
    background-size: contain;
}

.characterSheet .preferences {
    display: flex;
}

.characterSheet .preferences .section {
    font-size: 0.75em;
    flex-basis: 50%;
}

.characterSheet .preferences > div {
    background-color: var(--popup-background-color);
    border: 2px solid var(--section-border-color);
}

.characterSheet .relationships {
    flex: auto;
    background-color: var(--section-background-color);
}

.characterSheet .notes {
    background-color: var(--section-background-color);
}

.characterSheet .relationships .section.label {
    text-align: left;
}

.characterSheet hr {
    border: 2px solid var(--rule-color);
}

.characterSheet .row {
    display: flex;
}

.characterSheet .row1 .section {
    flex-basis: 50%;
    background-color: var(--section2-background-color);
    border: 2px solid var(--section2-border-color);
}

.characterSheet .section.health .label {
    text-align: center;
}

.characterSheet .row2 .section {
    flex-basis: 30%;
    background-color: var(--section2-background-color);
    border: 2px solid var(--section2-border-color);
}

.characterSheet .section.skills .label {
    text-align: center;
}

.section.alive {
    font-size: 2em;
    font-weight: bolder;
    text-align: center;
    display: table;
}

.section.alive span {
    display: table-cell;
    vertical-align: middle;
}

.section.religion div {
    white-space: nowrap
}

.characterSheet .row3 .section {
    flex-basis: 50%;
    background-color: var(--section2-background-color);
    border: 2px solid var(--section2-border-color);
}

.characterSheet .row4 .section {
    flex-basis: 100%;
    background-color: var(--section2-background-color);
    border: 2px solid var(--section2-border-color);
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.sheetImage {
    flex-basis: 60%;
    background-repeat: no-repeat;
    background-size: contain;
    background-color: var(--section2-background-color);
    background-position: center;
    border: 2px solid var(--section2-border-color);
    cursor: pointer;
}

.sheetName {
    font-size: 3em;
}

.sheetProperties {
    overflow-y: auto;
    margin-left: 1em;
    width: 100%;
}

table.properties {
    border-collapse: collapse;
}

table.properties tr {
    border-bottom: 1px solid var(--table-border);
}

hr.separator {
    height: 3px;
    border: none;
    background: var(--separator-color);
    margin-top: -20px;
}

table.properties th {
    white-space: nowrap;
    padding-right: 1em;
}

.characterGroupHeader {
    display: flex;
    margin: 1em 0em;
    width: 100%;
    padding: 8px;
    font-size: 2em;
    border: 2px solid var(--group-header-border-color);
    color: var(--group-header-color);
    flex-wrap: wrap;
    flex-direction: row;
    align-items: center;
}

.characterGroupHeader div {
    white-space: nowrap;
}

.characterGroupHeader.dark {
    color: var(--header-dark-color);
}

.characterGroupHeader.media {
    flex-direction: column;
    align-content: center;
    font-size: 3em;
}

tr.headerRow {
    border: none;
}

tr.headerRow th {
    padding-top: 1em;
    vertical-align: bottom;
}

.column_4 .row1 {
    flex-basis: 30%;
    overflow-y: auto;
}

.column_4 .row2 {
    flex-basis: 30%;
    overflow-y: auto;
}

.column_4 .row3 {
    flex-basis: 30%;
    overflow-y: auto;
}

.column_4 .row4 {
    flex-basis: 10%;
    overflow-y: auto;
}

.characterImageContainer {
    width: 90%;
    height: 90vh;
    display: flex;
    background: var(--popup-background-color);
    border: 8px solid var(--popup-border-color);
    flex-direction: column;
    z-index: var(--gallery-layer);
}

.characterImage {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex: auto;
}

.characterImageTitle {
    text-align: center;
    font-size: 2em;
    border-bottom: 2px solid var(--popup-border-color);
    margin-bottom: 8px;
}

.characterImageDescription {
    text-align: center;
    font-style: italic;
    border-top: 1px solid var(--popup-border-color);
    margin-top: 8px;
}

.allCharacters {
    width: 90%;
    height: 90vh;
    display: flex;
    background: var(--popup-background-color);
    border: 8px solid var(--popup-border-color);
    overflow: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
}

div.characterFull {
    display: flex;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom;
    cursor: pointer;
}

div.characterFullContainer {
    display: flex;
    flex-direction: column;
    margin-bottom: 32px;
}

div.characterFullName {
    font-family: cursive;
    text-align: center;
}

div.following {
    white-space: nowrap;
    padding-right: 32px !important;
}

div.characterRotateHint {
    font-weight: bold;
    color: var(--popup-border-color);
    text-align: center;
    font-style: italic;
    border-top: 1px solid var(--popup-border-color);
    margin-top: 8px;
}

span.characterGroupDescription {
    font-size: 0.75em;
    font-style: italic;
    margin-left: 2em;
}

@media (hover: hover) {
    .portraitContainer:hover .portraitName {
        background-color: var(--name-hover-background-color);
        border-color: var(--name-hover-border-color);
        color: var(--name-hover-color);
    }

    .portraitContainer:hover .portrait {
        background-color: var(--tile-hover-background-color);
    }
}