body {
    margin: 0px;
    overflow: hidden;
}

#lobby {
    margin: 4px;
}

#left_column {
    line-height: 1em;
}

#right_column {
    display: inline-block;
    vertical-align: top;
    position: absolute;
    right: 0px;
    top: 0px;
}

.colour_black { color: black; }
.colour_blue { color: blue; }
.colour_green { color: green; }
.colour_cyan { color: cyan; }
.colour_red { color: red; }
.colour_magenta { color: magenta; }
.colour_brown { color: brown; }
.colour_lightgray { color: lightgray; }
.colour_darkgray { color: darkgray; }
.colour_lightblue { color: lightblue; }
.colour_lightgreen { color: lightgreen; }
.colour_lightcyan { color: lightcyan; }
.colour_lightred { color: #EE9090; }
.colour_lightmagenta { color: #EE90EE; }
.colour_yellow { color: yellow; }
.colour_white { color: white; }

#stats {
    display: inline-block;
    position: static;
    color: #babdb6; /* lightgray */
}

#stats_titleline, #stats_species_god {
    color: #fce94f; /* yellow */
}
#stats_piety {
    color: #fce94f; /* yellow */
}
#stats_gozag_gold{
    color: #babdb6; /* lightgray */
}
#stats_piety.penance {
    color: #a40000; /* red */
}
#stats_piety.monk {
    color: #555753; /* darkgray */
}
#stats_wizmode {
    color: #204a87; /* blue */
}
.stats_caption {
    color: #8f5902; /* brown */
}

.degenerated_stat {
    color: #fce94f; /* yellow */
}
.zero_stat {
    color: #ef2929; /* lightred */
}
.low_stat {
    color: #a40000; /* red */
}
.boosted_stat {
    color: #729fcf; /* lightblue */
}

.degenerated_defense {
    color: #a40000; /* red */
}
.boosted_defense {
    color: #729fcf; /* lightblue */
}
#game #stats_weapon .corroded_weapon {
    color: #a40000; /* red */
}

.bar span {
    display: inline-block;
    height: 100%;
}

/* Some of these values are also hard coded to cell_renderer.js */
#stats_hp_bar {
    background-color: #555753; /* darkgray */
}
#stats_hp_bar_full {
    background-color: #8ae234; /* lightgreen */
}
#stats_hp_bar_decrease {
    background-color: #a40000; /* red */
}
#stats_hp_bar_poison {
    background-color: yellow;
}
#stats_hp_bar_increase {
    background-color: #4e9a06; /* green */
}

#stats_mp_bar {
    background-color: #555753; /* darkgray */
}
#stats_mp_bar_full {
    background-color: #729fcf; /* lightblue */
}
#stats_mp_bar_decrease {
    background-color: #5c3566; /* magenta */
}
#stats_mp_bar_increase {
    background-color: #204a87; /* blue */
}

#stats[data-species="Felid"] #stats_quiver_line {
    display: none;
}

/* default color when showing "Silenced" */
#stats_noise_status {
    color: #FF00FF; /* magenta */
}

/* default bar background color */
#stats_noise_bar {
    background-color: #2F2F2F; /* dark slate gray */
}

/* default bar change color */
#stats_noise_bar_decrease {
    background-color: #555753; /* darkgray */
}

/* clear the bar entirely */
#stats_noise[data-level="blank"] #stats_noise_bar,
#stats_noise[data-level="blank"] #stats_noise_bar_full {
    background-color: #000000; /* black */
}

/* noise number is printed here in wizmode */
#stats_noise_num {
    color: #D3D3D3; /* default gray */
    width: 0;
}
#stats_noise[data-shownum] #stats_noise_num {
    width: 2em;
}

/* use attribute selectors to adjust the bar and number (wizmode) color depending on `data-level`. */
#stats_noise[data-level="quiet"] #stats_noise_bar_full {
    background-color: #D3D3D3; /* lightgray */
}
#stats_noise[data-level="quiet"] #stats_noise_num {
    color: #D3D3D3;
}
#stats_noise[data-level="loud"] #stats_noise_bar_full {
    background-color: #FFD700; /* gold */
}
#stats_noise[data-level="loud"] #stats_noise_num {
    color: #FFD700;
}
#stats_noise[data-level="veryloud"] #stats_noise_bar_full {
    background-color: #FF0000; /* red */
}
#stats_noise[data-level="veryloud"] #stats_noise_num {
    color: #FF0000;
}
#stats_noise[data-level="superloud"]  #stats_noise_bar_full {
    background-color: #FF00FF; /* magenta */
}
#stats_noise[data-level="superloud"] #stats_noise_num {
    color: #FF00FF;
}

/* make the bar go to eleven on superloud sounds. */
#stats_noise_bar { width: 82%; }
#stats_noise[data-level="superloud"] #stats_noise_bar {
    width: 100%;
}

/* shrink the bar to the right in wizmode (if `data-shownum` is set). */
#stats_noise_inter { width: 61%; }
#stats_noise[data-shownum] #stats_noise_inter {
     width: 45%;
}

#message_pane {
    width: 100%;
}
#messages_container {
    display: block;
    overflow-x: hidden;
    overflow-y: hidden;
}
#messages {
    line-height: 1.4em;
    width: 100%;
}
.prefix_glyph.command_marker {
    color: #555753; /* darkgray */
}
.prefix_glyph.turn_marker {
    color: #babdb6; /* lightgray */
}
.game_message {
    white-space: pre-wrap;
}

#minimap_block {
    display: block;
}

#minimap, #minimap_overlay {
    position: absolute;
}


#tooltip {
    position: absolute;
    background: rgba(40, 40, 40, 0.5);
    padding: 5px;
    border: 1px solid lightgray;
}


/* monster list */
#monster_list {
    display: inline-block;
    overflow-x: hidden;
}

#monster_list .group {
    display: block;
}

#monster_list .picture {
    display: inline;
    vertical-align: middle;
}

#monster_list .name {
    vertical-align: middle;
}

#monster_list .trivial {
    color: #555753; /* darkgray */
}
#monster_list .easy {
    color: #babdb6; /* lightgray */
}
#monster_list .tough {
    color: #fce94f; /* yellow */
}
#monster_list .nasty {
    color: #ef2929; /* lightred */
}

#monster_list .friendly {
    color: #4e9a06; /* green */
}

#monster_list .good_neutral,
#monster_list .neutral,
#monster_list .strict_neutral {
    color: #8f5902; /* brown */
}

#monster_list .health {
    display: inline-block;
}

#monster_list .uninjured {
    background-color: #4e9a06; /* green */
}

#monster_list .lightly_damaged {
    background-color: #4e9a06; /* green */
}

#monster_list .moderately_damaged {
    background-color: #8f5902; /* brown */
}

#monster_list .heavily_damaged {
    background-color: #8f5902; /* brown */
}

#monster_list .severely_damaged {
    background-color: #5c3566; /* magenta */
}

#monster_list .almost_dead {
    background-color: #a40000; /* red */
}

#monster_list .ellipse {
    float: right;
}

/* scroller */
.scroller-shade {
    position: absolute;
    width: 100%;
    height: 12px;
    pointer-events: none;
}
.scroller-shade.top {
    top: 0;
    background: -webkit-gradient(linear, left top, left bottom, from(rgba(4, 2, 4, 0.784)), to(rgba(4, 2, 4, 0.001)));
    background: -webkit-linear-gradient(rgba(4, 2, 4, 0.784), rgba(4, 2, 4, 0.001));
    background: -o-linear-gradient(rgba(4, 2, 4, 0.784), rgba(4, 2, 4, 0.001));
    background: linear-gradient(rgba(4, 2, 4, 0.784), rgba(4, 2, 4, 0.001));
}
.scroller-shade.bot {
    bottom: 0;
    background: -webkit-gradient(linear, left top, left bottom, from(rgba(4, 2, 4, 0.001)), to(rgba(4, 2, 4, 0.784)));
    background: -webkit-linear-gradient(rgba(4, 2, 4, 0.001), rgba(4, 2, 4, 0.784));
    background: -o-linear-gradient(rgba(4, 2, 4, 0.001), rgba(4, 2, 4, 0.784));
    background: linear-gradient(rgba(4, 2, 4, 0.001), rgba(4, 2, 4, 0.784));
}
.simplebar-scroll-content {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}
.simplebar-content > :first-child {
    margin-top: 0 !important;
}
.simplebar-content > :last-child {
    margin-bottom: 0 !important;
}
.simplebar-track.vertical > .simplebar-scrollbar {
    width: 2px;
    border-left: 4px solid #040204;
    border-right: 5px solid #040204;
    background: #7d623c;
    opacity: 1 !important;
    background-radius: 0;
    left: 0;
    right: 0;
    cursor: pointer;
}
.simplebar-track {
    background: #040204;
}
.simplebar-track.vertical::before {
        position: absolute;
        top: 0;
        left: 4px;
        right: 5px;
        bottom: 0;
        background: #292929;
        content: ' ';
}
.simplebar-track .simplebar-scrollbar::before,
.simplebar-track.horizontal {
    display: none;
}
[data-simplebar="init"] {
    margin-right: -20px; /* matched in simplebar.js */
    padding-right: 20px; /* matched in simplebar.js */
}
.scroller-lhd {
    visibility: hidden;
    position: absolute;
}

/* paneset */
.paneset {
    display: -ms-inline-grid;
    display: inline-grid;
    min-height: 0;
}
.paneset > .pane {
    -ms-grid-row: 1;
    grid-row: 1;
    -ms-grid-column: 1;
    grid-column: 1;
    visibility: hidden;
}
.paneset > .pane.current {
    visibility: visible;
}

.paneset > .pane:not(.current) .simplebar-track {
    visibility: unset !important;
}

/* menus */
.menu {
    line-height: 1.2em;
    min-width: 40em;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    max-height: inherit;
}

.menu_title {
    white-space: pre;
    margin-bottom: 5px;
}

.menu_more {
    white-space: pre;
    margin-top: 5px;
}

.menu_contents {
    overflow: hidden;
}

.menu_contents ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu_contents li {
    white-space: pre;
    padding: 1px;
    border: 1px solid rgba(255, 255, 255, 0.001);
}

.menu_contents li.selectable:hover {
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    color: white;
}

.menu_contents li.selectable:active {
    background: black;
    border: 1px solid #222;
}

.menu_contents li.placeholder {
    color: darkgray;
}

.menu .pattern_select {
    height: 1em;
    border: 0;
    padding: 0;
    margin: 0;
    font-family: monospace;
    font-size: 16px;
}

#input_dialog {
    line-height: 1.2em;
    min-width: 20em; /* can override this with a tag-specific class */
    white-space: pre;

    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.input_skill_target input {
    max-width: 5em;
}

#game .fg0 { color: #000000; } /* black */
#game .fg1 { color: #204a87; } /* blue */
#game .fg2 { color: #4e9a06; } /* green */
#game .fg3 { color: #06989a; } /* cyan */
#game .fg4 { color: #a40000; } /* red */
#game .fg5 { color: #5c3566; } /* magenta */
#game .fg6 { color: #8f5902; } /* brown */
#game .fg7 { color: #babdb6; } /* lightgray */
#game .fg8 { color: #555753; } /* darkgray */
#game .fg9 { color: #729fcf; } /* lightblue */
#game .fg10 { color: #8ae234; } /* lightgreen */
#game .fg11 { color: #34e2e2; } /* lightcyan */
#game .fg12 { color: #ef2929; } /* lightred */
#game .fg13 { color: #ad7fa8; } /* lightmagenta */
#game .fg14 { color: #fce94f; } /* yellow */
#game .fg15 { color: #eeeeec; } /* white */

#game .bg0 { background-color: #000000; } /* black */
#game .bg1 { background-color: #204a87; } /* blue */
#game .bg2 { background-color: #4e9a06; } /* green */
#game .bg3 { background-color: #06989a; } /* cyan */
#game .bg4 { background-color: #a40000; } /* red */
#game .bg5 { background-color: #5c3566; } /* magenta */
#game .bg6 { background-color: #8f5902; } /* brown */
#game .bg7 { background-color: #babdb6; } /* lightgray */
#game .bg8 { background-color: #555753; } /* darkgray */
#game .bg9 { background-color: #729fcf; } /* lightblue */
#game .bg10 { background-color: #8ae234; } /* lightgreen */
#game .bg11 { background-color: #34e2e2; } /* lightcyan */
#game .bg12 { background-color: #ef2929; } /* lightred */
#game .bg13 { background-color: #ad7fa8; } /* lightmagenta */
#game .bg14 { background-color: #fce94f; } /* yellow */
#game .bg15 { background-color: #eeeeec; } /* white */

.menu_txt:not(.menu_crt_shrink) {
    width: 80ch;
}

.progress-bar {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}

.progress-bar > .bar-text {
    margin-top: 1em;
    margin-bottom: 1em;
    white-space: pre;
}

.describe-generic {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.describe-generic > .header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 20px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}
.describe-generic > .header > canvas {
    margin-right: 10px;
}
.describe-generic > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}

.describe-feature {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.describe-feature-feat {
    margin: 20px 0;
}
.describe-feature-feat > .header {
    margin: 0;
}
.describe-feature-feat > .header > canvas {
    margin-right: 10px;
}
.describe-feature-feat > .body {
    margin-top: 15px;
    font-size: 0.9em;
    white-space: pre-wrap;
}

.describe-item {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.describe-item > .header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 15px;
}
.describe-item > .header > canvas {
    margin-right: 10px;
}
.describe-item > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    white-space: pre-wrap;
}
.describe-item > .actions {
    margin-top: 15px;
    color: cyan;
}

.describe-spell {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.describe-spell > .header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 15px;
}
.describe-spell > .header > canvas {
    margin-right: 10px;
}
.describe-spell > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}
.describe-spell > .actions {
    margin-top: 15px;
    color: cyan;
}

.describe-cards {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.describe-card {
    margin: 20px 0;
}
.describe-card > .header {
    margin: 0;
}
.describe-card > .body {
    margin-top: 15px;
    font-size: 0.9em;
}
.describe-card > .body > :first-child {
    margin-top: 0 !important;
}
.describe-card > .body > :last-child {
    margin-bottom: 0 !important;
}

.mutations {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-width: 40em;
    max-height: inherit;
}
.mutations > .header {
    margin-bottom: 15px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}
.mutations > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}
.mutations > .footer {
    margin-top: 15px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}

.vamp-attrs {
    border-collapse: collapse;
    width: 100%;
}
.vamp-attrs tr.group th {
    padding-top: 1em;
}
.vamp-attrs thead th {
    padding-top: 5px;
    padding-bottom: 1em;
    text-align: center;
}
.vamp-attrs th, .vamp-attrs td {
    padding: 0.1em 0.5em;
}
.vamp-attrs th {
    font-weight: normal;
    text-align: left;
}
.vamp-attrs td {
    color: darkgrey;
}
.vamp-attrs td:not(:first-child) {
    text-align: center;
}
.vamp-attrs tr:last-child td {
    padding-bottom: 5px;
}

.describe-god {
    width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    max-height: inherit;
}
.describe-god > .header {
    margin-bottom: 15px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
}
.describe-god > .header > canvas {
    margin-right: 10px;
}
.describe-god > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}
.describe-god > .footer {
    margin-top: 15px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
.describe-god td {
    padding: 0;
}
.describe-god .god-favour td:nth-child(2) {
    white-space: pre;
}
.describe-god .god-powers > .power {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
.describe-god .god-powers > .power > :first-child {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    overflow: hidden;
}
.describe-god .god-powers > .power > :last-child {
    white-space: pre;
}
.describe-god .desc, .describe-god .god-favour, .describe-god .god-powers {
    margin: 1em 0;
}
.describe-god > body, .describe-god > .body .pane {
    width: 80ch; /* for IE11 */
}
.describe-god .body .tbl {
    white-space: pre;
}

.describe-monster {
    width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    max-height: inherit;
}
.describe-monster > .header {
    margin-bottom: 20px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}
.describe-monster > .header > canvas {
    margin-right: 10px;
}
.describe-monster > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
}
.describe-monster > .footer {
    margin-top: 20px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.formatted-scroller {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    white-space: pre;
    max-height: inherit;
}
.formatted-scroller > .body .highlight {
    background: rgba(255,255,0,0.196);
    width: 100%;
    display: block;
}

.spellset ol {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: 0.4em 0;
}
.spellset li {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 50%;
    flex: 0 0 50%;
    max-width: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}
.spellset li > span:nth-child(2) {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
}

.msgwin-get-line {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
}
.msgwin-get-line > .header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 20px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}
.msgwin-get-line > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    min-height: 1.1em;
    line-height: 1.1em;
}

/* Use crisp (nearest-neighbor) upscaling on HiDPI screens to avoid blurriness. */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    canvas {
        image-rendering: optimizeSpeed;
        image-rendering: -moz-crisp-edges;
        image-rendering: -webkit-optimize-contrast;
        -ms-interpolation-mode: nearest-neighbor;
        image-rendering: crisp-edges;
    }
}

#ui-stack {
    z-index: 3000;
}

.ui-popup-overlay {
    position: fixed;
    top: 0px;
    left: 0px;
    bottom: 0px;
    right: 0px;
    background-color: rgba(0,0,0,0.7);
}

.ui-popup {
    position: fixed;
    top: 0px;
    left: 0px;
    bottom: 0px;
    right: 0px;

    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: start;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    overflow: hidden;
}

/* progressively indent nested popups: four levels deel is probably enough */
.ui-popup + .ui-popup { padding-top: 20px; }
.ui-popup + .ui-popup + .ui-popup { padding-top: 40px; }
.ui-popup + .ui-popup + .ui-popup + .ui-popup { padding-top: 60px; }

.ui-popup.centred {
    padding-top: 0;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.ui-popup-outer {
    margin: 50px;
    max-height: calc(100vh - 100px);

    padding: 20px;
    background-color: #040204;
    border: 1px solid black;
    outline: 2px solid #7d623c;

    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    z-index: 0;
    position: relative;
}

.ui-popup-inner {
    position: relative; /* positioned so that it renders on top of bg */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    max-height: calc(100vh - 100px - 46px); /* for IE11 */
}
.ui-popup-inner:after {
    display: block;
    content: "";
    clear:both;
}

#game .ui-popup-inner .bg0 {
    background-color: transparent;
}

.hidden, .templates {
    display: none !important;
}

#ui-stack:not([data-display-mode="tiles"]) .glyph-mode-hidden {
    display: none !important;
}

.newgame-choice {
     display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.newgame-choice .header
{
    margin-bottom: 15px;
    white-space: pre;
    display: flex;
    align-items: center;
    flex: 1 0 auto;
}

.newgame-choice .header > canvas
{
    margin-right: 10px;
}

.newgame-choice > .body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.newgame-choice .grid
{
    display: grid;
    list-style: none;
    min-height: 0;
    flex: 1 1 auto;
}
.newgame-choice .sub-items
{
    flex: 1 0 auto;
}

.newgame-choice .grid .button {
    background: #040204;
    white-space: pre;
    padding: 1px;
    border: 1px solid rgba(255, 255, 255, 0.001);
}

@media screen and (max-height: 780px) {
    .newgame-choice .grid .button canvas {
        margin: -1px 0;
    }
    .ui-popup-outer {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    .ui-popup-inner {
        max-height: calc(100vh - 40px - 46px);
    }
}

.newgame-choice .grid .button.selected
{
    background: black;
    border: 1px solid #222;
}

.newgame-choice .grid .button.selected.hlc-7 { border: 1px solid #babdb6; } /* lightgrey */
.newgame-choice .grid .button.selected.hlc-1 { border: 1px solid #204a87; } /* blue */
.newgame-choice .grid .button.selected.hlc-2 { border: 1px solid #4e9a06; } /* green */

.newgame-choice .grid .button.selected:hover {
    cursor: pointer;
}

.newgame-choice .grid .button:active
{
    background: black;
    border: 1px solid #222 !important;
}

.newgame-choice .grid .button
{
    display: flex;
    align-items: center;
    padding-right: 1em;
}

.newgame-choice .grid .button > span
{
    margin-left: 6px;
}

#ui-stack[data-display-mode="tiles"] .newgame-choice .grid .label {
    align-self: end;
    margin-bottom: 0.75em;
    margin-left: 2px;
}

#ui-stack[data-display-mode="tiles"] .newgame-choice .grid .label::before {
    content: " ";
    display: inline-block;
    margin-left: 32px;
}

.newgame-choice .descriptions
{
    margin: 15px 0;
    max-width: 70ch;
    flex: 1 0 auto;
}

.game-over {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}
.game-over > .header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    margin-bottom: 20px;
    -webkit-box-flex: 0;
    -ms-flex: 0 0 auto;
    flex: 0 0 auto;
}
.game-over > .header > canvas {
    margin-right: 10px;
}
.game-over > .body {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    white-space: pre-wrap;
}

.seed-selection {
    max-width: 80ch;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 100%; /* for IE11 */
    max-height: inherit;
}

.seed-selection > .header {
    margin-bottom: 15px;
}

.seed-selection p {
    margin: 20px 0;
}

.seed-selection .seed-input {
    line-height: 1.2em;
    white-space: pre;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;

    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

#ui-stack .button-bar {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: flex-end;
    -ms-flex-pack: flex-end;
    justify-content: flex-end;
    margin-top: 10px;
}

#ui-stack .button-bar > button:last-child {
    margin-right: 0;
}

#ui-stack input {
    background: #1D1B15;
    color: #babdb6;
    border: 1px solid #7d623c;
}

#ui-stack button:hover {
    border: 1px solid #7d623c;
    background: #111;
}

#ui-stack button.style-focused:hover,
#ui-stack button.style-focused,
#ui-stack input.style-focused,
#ui-stack button:hover:focus,
#ui-stack button:focus,
#ui-stack input:focus {
    background: #1e1e1e;
    border: 1px solid #b88d19;
    outline: none;
}

#ui-stack button,
#ui-stack input[type=checkbox],
#ui-stack label {
    cursor: pointer;
}

#ui-stack label {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}
#ui-stack input[type=checkbox] {
    width: 20px;
    height: 20px;
    display: block;
    margin: 0 10px 0 0;
}
#ui-stack input[type=checkbox]:after {
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAH0lEQVR4AWOoTbIhG1FDMwOJYBBqHtU8qnlU88CVJACP6Z8xWMGK0wAAAABJRU5ErkJggg==');
    width: 20px;
    height: 20px;
    content: ' ';
    display: block;
}
#ui-stack input[type=checkbox]:hover:after,
#ui-stack input[type=checkbox]:focus:after,
#ui-stack input.style-focused[type=checkbox]:after
{
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAH0lEQVR4AWPY0StJNqKGZgYSwSDUPKp5VPOo5oErSQCXb8ThkznLHAAAAABJRU5ErkJggg==');
}
#ui-stack input[type=checkbox]:checked:after {
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAgMAAADw5/WeAAAADFBMVEV9YjwAAAC4jRnZuhDmQF8EAAAANUlEQVR4AWNABqyhoaEB6GQkmMwCkytBZNhSIFkaNRVI/s0CqalfCSLjl4LI8KlwvZgkEgAAnsAYOzDliTAAAAAASUVORK5CYII=');
}
#ui-stack input[type=checkbox]:hover:checked:after,
#ui-stack input[type=checkbox]:focus:checked:after,
#ui-stack input.style-focused[type=checkbox]:checked:after
{
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAgMAAADw5/WeAAAACVBMVEW4jRkAAADZuhDLYpq6AAAANElEQVR4AWNABqyhoaEB6GQgmHQAk4wgMoQVSKYGiALJlQ4gNVmMIDKKFUSGicL1YpJIAACbBRPEM0MirwAAAABJRU5ErkJggg==');
}

#ui-stack button {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    background: #040204;
    border: 1px solid transparent;
    margin: 0 10px;
    color: #babdb6;
    padding: 4px 8px;
    font-family: monospace;
    cursor: pointer;
}
