﻿html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
}

.spacer {
    display: none;
}

.popup {
    box-sizing: border-box;
    background-color: Window;
    color: WindowText;
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    border-radius: 4px;
    padding: 9px;
    text-align: center;
    z-index: 1;
}

.popup:empty {
    display: none;
}

#characterInfo img {
    max-width: calc(100% - 50px);
    max-height: 300px;
    margin: 25px;
    margin-bottom: 0;
}

.popup .main {
    height: calc(100% - 56px);
    overflow-y: auto;
}

#teamSetup textarea {
    width: calc(50% - 10px);
    height: 100%;
    box-sizing: border-box;
}

.popup .buttons {
    clear: both;
    width: 100%;
    margin: 4px;
}

.popup .buttons > * {
    padding: 4px;
    min-width: 64px;
}

#teamSelect .main > div {
    display: block;
    padding: 4px 0;
}

#mainScreen > .lineup {
    position: absolute;
    top: 0;
    width: 80px;
    height: 100%;
}

#mainScreen > .lineup1 {
    left: 0;
}

#mainScreen > .lineup2 {
    right: 0;
}

.currentBatterInfo {
    display: block;
    overflow-y: hidden;
    font-size: 11px;
    height: 36px;
    text-align: center;
}

.batter {
    display: block;
    border: 1px solid black;
    border-radius: 8px;
    padding: 3px;
    overflow-y: hidden;
}

.batter > .batterImage {
    float: left;
    width: 100%;
    height: 100%;
    min-height: 24px;
    min-height: calc(10vh - 16px); /* Workaround for Safari */
    border-radius: 8px;
    margin-right: 8px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: block;
    text-align: center;
}

.batter.current {
    background-color: lightblue;
    color: black;
}

.lineup.current .batter.current {
    background-color: black;
    color: white;
}

.batterInfo {
    display: none;
}

#result {
    height: 70px;
    overflow-y: auto;
}

.batterName > span {
    background-color: white;
    background-color: rgba(255, 255, 255, 0.75);
    color: black;
    padding: 0 0.5em;
}

#mainScreen > .center {
    position: absolute;
    top: 0;
    left: 64px;
    width: 192px;
    width: calc(100% - 160px);
    text-align: center;
}

#outMeter {
    height: 16px;
    font-size: 12px;
    font-weight: bold;
}

#outMeter, #outMeter > span {
    background-color: darkred;
    color: white;
}

#tables {
    display: block;
}

.stateTable {
	display: inline-table;
	width: 32px;
	vertical-align: bottom;
    font-size: 8px;
}

#basesTable {
	width: 96px;
}

.stateTable > * {
    text-align: center;
	display: table-row;
}

.stateTable > * > * {
	display: table-cell;
	width: 32px;
	height: 12px;
	height: calc(10vh - 30px);
    min-height: 12px;
}

.stateTable > * > * > * {
    height: 100%;
    border-style: solid;
    border-width: 2px;
    border-width: 1vmin;
    box-sizing: border-box;
}

.preview .stateTable {
    font-size: 16px;
}

table.vertical td {
    text-align: start;
    line-height: 32px;
    width: 32px;
    writing-mode: vertical-lr;
    border: 0;
    padding: 0;
}

.preview .stateTable > * > * {
    height: 24px;
}

.preview .stateTable > * > * > * {
    border-width: 2px;
}

.new {
    background-color: darkseagreen;
}

.score > :not(.spacer) {
    display: inline-block;
    text-align: center;
    font-size: 12px;
    border-radius: 2px;
    padding: 0 2px;
    background-color: white;
}

.score > .runs {
    background-color: skyblue;
}

.score > .newRuns {
    background-color: darkseagreen;
}

.score > :first-child {
    margin-left: 10px;
}

.score > :last-child {
    margin-right: 10px;
}

.buttons, .links {
    text-align: center;
}

#mainScreen .buttons > * {
    width: calc(100% - 32px);
    padding: 4px 0;
    margin: 4px;
}

.buttons:not(:empty) {
    text-align: center;
    margin: 10px 0;
}

body.wiiu #mainScreen > .center {
    width: 384px;
    left: 235px;
}

body.wiiu #mainScreen .buttons > * {
    width: 96px;
}

body.wiiu #basesTable {
    width: 192px;
}

body.wiiu .stateTable > * > * > * {
    border-width: 2px;
}

noscript > div {
    background-color: white;
    color: black;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

@media screen and (min-width: 400px) {
    .score > :not(.spacer) {
        font-size: 16px;
    }
}

@supports (display: flex) {
    #mainScreen {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: row;
    }
    #mainScreen > .lineup {
        position: initial;
        flex: 1 0 64px;
        display: flex;
        flex-direction: column;
    }
    #mainScreen > .center {
        position: initial;
        flex: 0 0 50%;
    }
    .batter {
        flex: 1 1 50px;
    }
    .currentBatterInfo {
        flex: 0 0 auto;
    }

    #tables {
        display: flex;
        flex-direction: row;
    }
    #tables > * {
        flex: 1 0 20%;
        display: flex;
        flex-direction: column;
    }
    #basesTable {
        flex: 1 0 60%;
    }
    #tables > * > * {
        display: flex;
        flex-direction: row;
    }
    #tables > * > * > * {
        flex: 1 0 32px;
        display: block;
    }
    .score {
        display: flex;
        flex-direction: row;
    }
    .score .spacer {
        display: initial;
        flex: 1 1 0px;
    }
    @media screen and (min-width: 370px) {
        #characterInfo img {
            max-width: 300px;
        }
    }
    @media screen and (min-height: 500px) {
        .stateTable {
            font-size: 16px;
        }
    }
    @media screen and (min-height: 570px) and (min-width: 800px) {
        .popup {
            width: 90%;
            height: auto;
            left: 5%;
            top: 5%;
            border: 1px solid black;
        }
        #teamSetup {
            height: 90%;
        }
        #characterInfo img {
            float: left;
        }
        .spacer {
            display: initial;
            flex: 1 1 0px;
        }
        #mainScreen > .lineup {
            flex: 0 1 250px;
        }
        #mainScreen > .center {
            flex: 0 0 350px;
        }
        .currentBatterInfo {
            display: none;
        }
        .batter {
            flex: 0 1 50px;
        }
        .batter > .batterImage {
            width: 50px;
			min-height: 50px;
        }
        .batterInfo {
            display: inline;
        }
        #tables > * > * > * {
            height: 24px;
        }
        .stateTable > * > * > * {
            border-width: 4px;
        }

        .big-number {
            font-size: 200%;
        }

        .score > :not(.spacer) {
            display: inline-block;
            text-align: center;
            padding: 0 12px;
            margin: 4px;
            margin-left: 30px;
            margin-right: 30px;
            border-radius: 8px;
            font-size: 16px;
        }
    }
}
