body:not(.state-noscript)    #noscript-box,
body:not(.state-noasync)     #noasync-box,
body:not(.state-loading)     #loading-box,
body:not(.state-choose)      #choose-box,
body:not(.state-assign)      #assign-box,
body:not(.state-ocr)         #ocr-box,
body:not(.state-namecorrect) #namecorrect-box,
body:not(.state-neuronparse) #neuronparse-box,
body:not(.state-decklist)    #decklist-box
{ display: none; }

html, body { margin: 0; height: 100%; width: 100%; }
body
{
    background: #cccccc;
    font-family: Verdana, Geneva, sans-serif;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.state-noscript, body.state-noasync
{
    background: #777;
}

#noscript-box, #noasync-box
{
    background: #555;
    border-radius: 1vmin;
    padding: 1vmin;
    width: 80vw;
}

#noscript-box > div, #noasync-box > div
{
    border: .2vmin inset #fff;
    background: #ccc;
    padding: .2vmin;
    
    text-align: left;
}

#noscript-box header, #noasync-box header
{
    font-size: 1.3em;
    font-weight: bold;
    border-bottom: 1px solid #000;
    margin-bottom: .3em;
}

#noscript-box p, #noasync-box p
{
    margin: .5em .5em;
}

#noscript-box p + header, #noasync-box p + header
{
    margin-top: 1em;
}

#noscript-box ul, #noasync-box ul
{
    margin: .5em 0;
}

#noscript-box img
{
    float: right;
    width: 5em;
    height: 5em;
    background: #ccc;
}

#loading-box
{
    display: flex;
    flex-direction: column;
    align-items: center;
    
    padding: 2vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    cursor: default;
}

#loading-box img
{
    width: 5vmin;
    flex-basis: 5vmin;
    flex-grow: 0;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    padding: .5vmin;
    background: #fff;
}

#loading-box span
{
    margin-top: 1.5vmin;
    font-family: Monospace;
    font-size: 3vmin;
    text-align: center;
}

#choose-box
{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    align-self: stretch;
    flex-grow: 1;
}

#choose-elm
{
    display: flex;
    flex-direction: row;
    align-items: center;

    padding: 2vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    cursor: pointer;
}

#pdf-input
{
    margin-left: 2vw;
    border: .25vmin solid #777;
    padding: .5vmin;
    border-radius: 1vmin;
    background: #ccc;
}
#choose-elm:hover #pdf-input { background: #ddd; }

#about
{
    margin-top: .5em;
    font-size: .7em;
    color: #999;
    cursor: default;
}
#about span { color: #666; }
#about a[href]
{
    cursor: pointer;
    text-decoration: underline;
    color: #000;
}

#assign-box
{
    display: flex;
    flex-direction: row;
    align-items: stretch;
    
    padding: 1vh 1vw;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    width: 93vw;
    height: 93vh;
}

#pdf-column
{
    flex-basis: 0;
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: hidden;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#pdf-container
{
    position: relative;
    border: .5vmin outset #000;
    background: #fff;
    flex-basis: 90vmin;
    flex-grow: 0;
    width: 69.5455vmin;
    pointer-events: none;
}

#pdf-marker-main, #pdf-marker-extra, #pdf-marker-side
{
    position: absolute;
    border: 1px dotted #000;
    box-sizing: border-box;
    padding-top: .9vmin;
    padding-left: .695vmin;
    
    font-weight: bold;
    
    opacity: 0;
    z-index: 1;
    background: rgba(128,128,128,0.7);
    cursor: default;
    pointer-events: auto;
}
#pdf-marker-main:hover, #pdf-marker-extra:hover, #pdf-marker-side:hover { opacity: 1; }

.pdf-element
{
    position: absolute;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 0;
    background: #fff;
}

.pdf-element:not(.highlight) { opacity: .6; }

.pdf-element.highlight
{
    padding: 1px;
    border: 2px solid #000;
    margin: -3px;
    z-index: 2;
}

#assign-right-box
{
    flex-basis: 12vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#assign-controls
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    
    flex-basis: 0;
    flex-grow: 3;
}

#assign-controls > div
{
    padding: .5vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
}
#assign-controls > div + div { margin-top: 1vmin; }
#assign-controls > div > header
{
    align-self: flex-start;
    margin-left: 2%;
    margin-bottom: 1%;
    font-weight: bold;
}

#assign-main-buttons
{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
}
#assign-main-buttons > input
{
    flex-basis: 0;
    flex-grow: 1;
    font-weight: bold;
}
#assign-close { background: #a00; }
#assign-next { background: #0a0; }

#assign-parse-box
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
#assign-parse-box > div
{
    display: flex;
    flex-direction: row;
    align-items: center;
}
#assign-alg { flex-grow: 1; }
#assign-parse { margin-left: .1vw; }

.checks-box
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.checks-box > div
{
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    margin: 0 .5vw;
}
.checks-box > div > label
{
    font-family: Monospace;
    padding: 0 .2vw;
    border-radius: .5vw;
    background: rgba(255,255,0,.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.checks-box > div.good > label { background: none; }
.checks-box > div.bad  > label { background: rgba(255,0,0,.7); }
.checks-box > div > span
{
    font-family: Monospace;
    margin-left: auto;
    border-radius: .5vw;
    background: rgba(255,255,0,.3);
    min-width: 1.4em;
    min-height: 1.4em;
    text-align: center;
}
.checks-box > div.good > span { background: rgba(0,255,0,.3); }
.checks-box > div.bad  > span { background: rgba(255,0,0,.7); line-height: 1.4em; }
.checks-box > div > span:empty { visibility: hidden; }

#assign-buttons-box
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.logger
{
    font-family: Monospace;
    
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    
    margin-top: auto;
    background: #bbb;
    border: 1px solid #777;
    padding: .5vmin;
    
    overflow-x: hidden;
    overflow-y: scroll;
    
    flex-basis: 0;
    flex-grow: 1;
}

.logger span { white-space: pre-wrap; }
.logger > :first-child { margin-bottom: auto; }

#ocr-box
{
    display: flex;
    flex-direction: row;
    align-items: stretch;
    
    padding: 1vw 1vh;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    width: 93vw;
    height: 93vh;
}

#ocr-canvases-container
{
    flex-basis: 0;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

#ocr-canvases-container > div
{
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#ocr-canvases-container > div > canvas
{
    max-height: 100%;
    max-width: 100%;
}

#ocr-canvas-generated { background: rgba(127,127,127,.9); transition: opacity .8s; }
#ocr-canvas-generated.redrawing { visibility: hidden; }
#ocr-canvas-generated.hidden { opacity: 0 }

#ocr-canvases-container * { pointer-events: none; }
#ocr-canvas-original { pointer-events: all; }

#ocr-edit-box
{
    flex-basis: 16vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: .5vw;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#ocr-edit-box.content #ocr-edit-box-background
{
    display: none;
}

#ocr-edit-box:not(.content) > :not(#ocr-edit-box-background)
{
    display: none;
}

#ocr-edit-show
{
    max-width: 100%;
}

#ocr-edit-count-row
{
    margin-top: .3vh;
}

#ocr-edit-count-row > input
{
    width: 2em;
}

#ocr-edit-count-row > span
{
    margin-left: .2em;
}

#ocr-edit-results-box
{
    margin-top : .3vh;
    flex-shrink: 1;
    flex-grow: 1;
    overflow: hidden;
    
    display: flex;
    flex-direction: column;
    
    border-radius: 1vmin;
    background: #bbb;
    border: 1px solid #777;
    
    font-family: Helvetica, sans-serif;
    font-size: 80%;
}

#ocr-edit-results-status
{
    text-align: center;
    padding: .2em 0;
    
    font-weight: bold;
    font-style: italic;
    
    background: #555;
    color: #ccc;
    
    cursor: default;
}
#ocr-edit-results-box:not(.loading) > #ocr-edit-results-status { display: none; }

#ocr-edit-results
{
    flex-shrink: 1;
    flex-grow: 1;
    overflow-y: auto;
    
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.ocr-search-result
{
    display: flex;
    flex-direction: row;
    align-items: center;
    
    padding: .2vh .3vw;
    cursor: pointer;
}
.ocr-search-result:hover
{
    background: rgba(0,0,0,0.3);
}

.ocr-search-result-flag
{
    display: block;
    width: auto;
    height: 1em;
}

.ocr-search-result-name
{
    flex-grow: 1;
    margin-left: .4em;
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ocr-search-result-name.vague
{
    font-style: italic;
    color: #555;
}

#ocr-edit-search
{
    margin-top: .3vh;
}

#ocr-right-box
{
    flex-basis: 12vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#ocr-controls
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    
    flex-basis: 0;
    flex-grow: .5;
}

#ocr-controls > div
{
    padding: .5vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
}
#ocr-controls > div + div { margin-top: 1vmin; }
#ocr-controls > div > header
{
    align-self: flex-start;
    margin-left: 2%;
    margin-bottom: 1%;
    font-weight: bold;
}

#ocr-main-buttons
{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
}
#ocr-main-buttons > input
{
    flex-basis: 0;
    flex-grow: 1;
    font-weight: bold;
}
#ocr-back { background: #a00; }
#ocr-next { background: #0a0; }
#ocr-next:disabled { background: #8a8; }

#ocr-extra-buttons
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#namecorrect-box
{
    display: flex;
    flex-direction: row;
    align-items: stretch;
    
    padding: 1vh 1vw;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    width: 93vw;
    height: 93vh;
}

#nc-cards-container
{
    font-family: 'Open Sans Condensed', sans-serif;
    font-size: 80%;
    
    overflow-x: hidden;
    overflow-y: auto;

    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    flex-grow: 1;
}

.nc-card-box
{
    display: inline-flex;
    flex-direction: column-reverse;
    
    width: 8.2vw;
    height: 6vw;
    margin: .5vw;
    border-radius: .5vw;
    border: .2vw solid #777;
    
    background-color: #aaa;
    background-size: 6vw auto;
    background-repeat: no-repeat;
}
.nc-card-box.needadj { background: #a00; }

.nc-orig-text
{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2% 1% 4%;
    padding: 0% 3%;
    background: rgba(190,190,190,0.9);
    text-align: center;
}
.nc-card-box.needadj .nc-orig-text { text-decoration: line-through; }

.nc-adj-text
{
    margin: 2% 1%;
    padding: 0% 3%;
    text-align: center;
}
.nc-card-box:not(.needadj.with-edit-box) .nc-adj-text { display: none; }

.nc-search-results
{
    flex-grow: 1;
    flex-basis: 0;
    margin: 1%;
    
    background: #ccc;
    border-radius: .5vw;
    border: .2vw solid #777;
    
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    justify-content: center;
    align-items: center;
}
.nc-card-box.matched .nc-search-results { display: none; }

.nc-search-results-container
{
    max-width: 100%;
    flex-grow: 1;
    overflow-x: hidden;
    overflow-y: auto;
    
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}
.nc-search-results:not(.has-results) .nc-search-results-container { display: none; }

.nc-search-result
{
    display: flex;
    flex-direction: row;
    align-items: center;
    
    padding: 0 .3vw;
    cursor: pointer;
}
.nc-search-result:hover
{
    background: rgba(0,0,0,0.3);
}

.nc-search-result-flag
{
    display: block;
    width: 10%;
    height: auto;
}

.nc-search-result-name
{
    flex-grow: 1;
    margin-left: 3%;
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nc-search-results-other
{
    padding: 0 .3vw;
    cursor: pointer;
    align-self: stretch;
}
.nc-search-results-other:hover { background: rgba(0,0,0,0.3); }
.nc-search-results.loading .nc-search-results-other { display: none; }
.nc-card-box.with-edit-box .nc-search-results-other { display: none; }

.nc-load-icon
{
    width: 1.8vw;
    height: 1.8vw;
    aspect-ratio: 1 / 1;
}

.nc-search-results:not(.loading) .nc-load-icon,
.nc-search-results:not(.loading) .nc-load-text
{ display: none; }

#nc-controls
{
    flex-basis: 12vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#nc-controls > div
{
    padding: .5vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
}
#nc-controls > div + div { margin-top: 1vmin; }
#nc-controls > div > header
{
    align-self: flex-start;
    margin-left: 2%;
    margin-bottom: 1%;
    font-weight: bold;
}

#nc-main-controls
{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
}
#nc-main-controls > input
{
    min-width: 0;
    flex-basis: 0;
    flex-grow: 1;
    flex-shrink: 0;
    font-weight: bold;
}
#nc-back { background: #a00; }
#nc-next { background: #0a0; }
#nc-next:disabled { background: #393; }

#neuronparse-box
{
    display: flex;
    flex-direction: row;
    align-items: stretch;
    
    padding: 1vw 1vh;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    width: 93vw;
    height: 93vh;
}

#neuron-canvases-container
{
    flex-basis: 0;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

#neuron-canvases-container > div
{
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#neuron-canvases-container > div > canvas
{
    max-height: 100%;
    max-width: 100%;
}

#neuron-canvas-generated { transition: opacity .8s; }
#neuron-canvas-generated.redrawing { visibility: hidden; }
#neuron-canvas-generated.hidden { opacity: 0; }

#neuron-canvases-container * { pointer-events: none; }
#neuron-canvas-original { pointer-events: all; }

#neuronparse-edit-box
{
    flex-basis: 16vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: .5vw;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#neuronparse-edit-box.content #neuronparse-edit-box-background
{
    display: none;
}

#neuronparse-edit-box:not(.content) > :not(#neuronparse-edit-box-background)
{
    display: none;
}

#neuronparse-edit-info-row
{
    display: flex;
    flex-direction: row;
    align-items: flex-end;
}

#neuronparse-edit-show
{
    width: 3vw;
    height: 4.5vw;
    margin-right: .5vw;
}

#neuronparse-edit-grid
{
    margin: .5vh 0;
    padding: .25vh 0;
    flex-grow: 1;
    flex-shrink: 1;
    overflow-y: auto;
    border-radius: 1vmin;
    background: #bbb;
    border: 1px solid #777;
    
    display: grid;
    grid-template-columns: 3.75vw 3.75vw 3.75vw 3.75vw;
    justify-content: space-evenly;
    align-content: flex-start;
}

#neuronparse-edit-grid > div
{
    width: 3.5vw;
    height: 5.25vw;
    position: relative;
    margin: .125vw;
}

#neuronparse-edit-grid > div > img
{
    width: 100%;
    height: 100%;
}

#neuronparse-edit-grid > div > span
{
    position: absolute;
    right: 0;
    bottom: 0;
    padding: .25vmin;
    background: rgba(0,0,0,0.8);
    
    font-size: 1em;
    font-weight: bold;
    font-family: Monospace;
    color: #fff;
    
    pointer-events: none;
    
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

#neuronparse-edit-buttons
{
    display: flex;
    flex-direction: row;
    align-items: middle;
}

#neuronparse-edit-left, #neuronparse-edit-right
{
    padding: .25vmin;
    border: 1px solid #000;
    border-radius: .5vmin;
    background: #ddd;
}
#neuronparse-edit-left:hover:not(:disabled), #neuronparse-edit-right:hover:not(:disabled)
{
    background: #eef;
}
#neuronparse-edit-left:active:not(:disabled), #neuronparse-edit-right:active:not(:disabled)
{
    background: #bbb;
    border-style: inset;
}
#neuronparse-edit-left:disabled, #neuronparse-edit-right:disabled
{
    background: #ddd;
    color: #999;
    border-color: #aaa;
}

#neuronparse-edit-status
{
    flex-grow: 1;
    text-align: center;
}

#neuronparse-right-box
{
    flex-basis: 12vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#neuronparse-controls
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    
    flex-basis: 0;
    flex-grow: .5;
}

#neuronparse-controls > div
{
    padding: .5vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
}
#neuronparse-controls > div + div { margin-top: 1vmin; }
#neuronparse-controls > div > header
{
    align-self: flex-start;
    margin-left: 2%;
    margin-bottom: 1%;
    font-weight: bold;
}

#neuronparse-main-buttons
{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
}
#neuronparse-main-buttons > input
{
    flex-basis: 0;
    flex-grow: 1;
    font-weight: bold;
}
#neuronparse-close { background: #a00; }
#neuronparse-next { background: #0a0; }
#neuronparse-next:disabled { background: #8a8; }

#neuronparse-buttons-box
{
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#decklist-box
{
    display: flex;
    flex-direction: row;
    align-items: stretch;
    
    padding: 1vw 1vh;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    width: 93vw;
    height: 93vh;
}

#decklist-left-box
{
    flex-grow: 1;
    
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.decklist-deck-box
{
    position: relative;
    min-width: 16vw;
    overflow-x: hidden;
    overflow-y: auto;
}

.decklist-deck-box + .decklist-deck-box { margin-left: 1vw; }

.decklist-header
{
    position: absolute;
    left: 1vw;
    top: 0;
    
    height: 1.4em;
    line-height: 1.4em;
    
    font-weight: bold;
    font-size: 1.2em;
    white-space: nowrap;
    
    padding: .3em;
    border: .2em solid #777;
    border-radius: 1vmin;
    
    background: #ccc;
}

.decklist-container
{
    background: #ccc;
    
    margin-top: 1em;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    padding: 1vmin;
    padding-top: 1.7em;
    
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
}

.decklist-card
{
    padding: 0 .2vw;
    border-radius: .5vmin;
}

.decklist-card.error
{
    background: rgba(255,0,0,.4);
}

.decklist-card-name
{
    margin-left: .3em;
}

.decklist-card-name.loading
{
    color: #888;
    font-style: italic;
}

#decklist-controls
{
    flex-basis: 12vw;
    flex-grow: 0;
    flex-shrink: 0;
    min-width: 0;
    margin-left: 1vw;
    
    padding: 1vmin;
    background: #ccc;
    border: .5vmin solid #777;
    border-radius: 1vmin;
    
    display: flex;
    flex-direction: column;
}

#decklist-controls > div
{
    padding: .5vmin;
    background: #aaa;
    border: .5vmin solid #777;
    border-radius: 1vmin;
}
#decklist-controls > div + div { margin-top: 1vmin; }
#decklist-controls > div > header
{
    align-self: flex-start;
    margin-left: 2%;
    margin-bottom: 1%;
    font-weight: bold;
}

#decklist-main-controls
{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
}
#decklist-main-controls > input
{
    min-width: 0;
    flex-basis: 0;
    flex-grow: 1;
    flex-shrink: 0;
    font-weight: bold;
}
#decklist-back { background: #a00; }
#decklist-decklist { background: #0a0; }
#decklist-decklist:disabled { background: #393; }
