html {
    height: 100%;
}

body {
    margin: 0;
    height: 100%;
    margin-left: auto;
    margin-right: auto;
    max-width: 1024px;
    font-family: sans-serif;
    overflow: hidden;
}

.root {
    height: 100%;
}

.select {
    max-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    row-gap: 10px;
    justify-items: center;
}

.select .search {
    margin-top: 10px;
    grid-row: 1;
    max-width: 400px;
    width: 100%;
}

.select .search input {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid lightgrey;
    border-radius: 5px;
    font-family: inherit;
    font-size: inherit;
}

.select .game-list {
    grid-row: 2;
    max-width: 400px;
    width: 100%;
    overflow-y: auto;
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: repeat(2, auto auto);
    gap: 0.5em;
}

.game-list .item {
    border-radius: 5px;
    background-color: lightgrey;
    padding: 0.5em;
    display: grid;
    grid-column: span 3;
    grid-row: span 2;
    gap: 0.2em;
    grid-template-rows: subgrid;
    grid-template-columns: subgrid;
}

.game-list .item .date {
    grid-row: 1;
    grid-column: 1;
    justify-self: center;
}

.game-list .item .time {
    grid-row: 2;
    grid-column: 1;
    justify-self: center;
}

.game-list .item .team-home {
    grid-row: 1;
    grid-column: 2;
    justify-self: start;
}

.game-list .item .team-away {
    grid-row: 2;
    grid-column: 2;
    justify-self: start;
}

.game-list .item .score-home {
    grid-row: 1;
    grid-column: 3;
    justify-self: end;
}

.game-list .item .score-away {
    grid-row: 2;
    grid-column: 3;
    justify-self: end;
}

.game-list .item .winner {
    font-weight: bold;
}

.best {
    color: lightgreen;
}

.play-by-play {
    height: 100%;
    display: grid;
    grid-template-columns: auto 100fr auto;
    grid-template-rows: 5fr auto auto auto;
    row-gap: 10px;
    justify-items: stretch;
    align-items: stretch;
    justify-content: center;
    align-content: start;
}

.back-button {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 1.1em;
    height: 1.1em;
    border-radius: 5px;
    background-color: lightgrey;
    line-height: 1.1em;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
}

.stats-players-home {
    grid-row: 1/3;
    grid-column: 1;
    align-self: end;
    margin: 10px 0 0 10px;
    border-radius: 5px;
    background-color: black;
    color: white;
    padding: 10px;
}

.stats-players-guest {
    grid-row: 1/3;
    grid-column: 3;
    align-self: end;
    margin: 10px 10px 0 0;
    border-radius: 5px;
    background-color: black;
    color: white;
    padding: 10px;
}

.players .dorsal {
    text-align: right;
}

.players .name {
    width: 5em;
    white-space: nowrap;
    overflow: hidden;
}

.players .fouls {
    text-align: right;
}

.players .fouls.out {
    text-align: right;
    color: lightcoral;
}

.players .score {
    text-align: right;
    min-width: 2ex;
}

.players .playing {
    color: orange;
}

.ticker-container {
    grid-row: 1;
    grid-column: 2;
    align-self: end;
    margin: 10px 10px 0 10px;
    display: flex;
    flex-flow: column;
    height: 100%;
    min-height: 0;
}

.ticker {
    overflow-y: scroll;
    display: grid;
    grid-template-columns: 1fr;
    row-gap: 10px;
    justify-items: stretch;
    align-items: start;
    justify-content: stretch;
    align-content: start;
}

.ticker-blank {
    height: 100vh;
}

.ticker .row {
    display: grid;
    grid-template-columns: 30fr 70fr auto 70fr 30fr;
    grid-template-rows: 1fr;
    row-gap: 10px;
    column-gap: 10px;
    align-items: baseline;
}

.ticker .row .action {
    border-radius: 5px;
    background-color: lightgrey;
    padding: 5px;
}

.ticker .row .both {
    grid-column: 1/6;
    background: none;
    padding: 5px 0 5px 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 10px;
}

.ticker .row .both .line {
    background-color: black;
    height: 1px;
    align-self: center;
}

.ticker .row .home {
    grid-column: 1 / 3;
    text-align: right;
}

.ticker-clock,
.score-divider {
    grid-column: 3;
    justify-self: center;
}

.score-divider {
    font-size: 24px;
    font-weight: bold;
}

.ticker .row .guest {
    grid-column: 4 / 6;
}

.ticker .row .score {
    background-color: darkgreen;
    color: white;
}

.ticker .row .miss {
    background-color: darkred;
    color: white;
}

.ticker-score {
    vertical-align: middle;
    font-size: 24px;
    font-weight: bold;
}

.ticker .space {
    margin-bottom: 20px;
}

.ticker .row .home.expanded {
    grid-column: 1 / 5;
}

.ticker-clock.home-expanded {
    grid-column: 5;
}

.ticker-clock.guest-expanded {
    grid-column: 1;
}

.ticker .row .guest.expanded {
    grid-column: 2 / 6;
}

.shot-clock {
    grid-row: 2;
    grid-column: 2;
    position: relative;
    display: grid;
    grid-template-columns: 100fr 3em 100fr;
    grid-template-rows: 1fr;
    column-gap: 10px;
    font-size: 24px;
    font-weight: bold;
}

.shot-clock .ball-possession {
    display: none;
    grid-row: 1;
}

.shot-clock .ball-possession.home {
    display: block;
    grid-column: 1;
    text-align: right;
}

.shot-clock .ball-possession.guest {
    display: block;
    grid-column: 3;
}

.shot-clock .counter {
    grid-row: 1;
    grid-column: 2;
    justify-self: center;
    white-space: nowrap;
}

.shot-clock .controls {
    position: absolute;
    right: 0;
}

.shot-clock .start-button,
.shot-clock .play-button,
.shot-clock .end-button {
    float: right;
    margin-right: 10px;
    width: 1.1em;
    height: 1.1em;
    border-radius: 5px;
    background-color: lightgrey;
    line-height: 1.1em;
    text-align: center;
}

.shot-clock .offset-input {
    display: none;
    float: right;
    margin-right: 10px;
    width: 2em;
    height: 1.1em;
    line-height: 1.1em;
    text-align: center;
}

.shot-clock .offset-input.live {
    display: block;
}

.game-clock-slider {
    grid-row: 3;
    grid-column: 1/4;
    margin: 0 10px 0 10px;
    height: 1ex;
    position: relative;
    display: grid;
    justify-items: stretch;
    column-gap: 2px;
}

.game-clock-slider-handle .dragging {
    background-color: lightgreen;
}

.game-clock-slider-handle {
    position: absolute;
    top: -0.5ex;
    width: 2ex;
    height: 2ex;
    border-radius: 1ex;
    background-color: orange;
}

.game-clock-quarter,
.game-clock-overtime {
    border-radius: 5px;
    background-color: black;
}

.overview {
    grid-row: 4;
    grid-column: 1/4;
    margin: 0 10px 10px 10px;
    border-radius: 5px;
    background-color: black;
    color: white;
    padding: 10px;
    padding-bottom: env(safe-area-inset-bottom);
    justify-self: stretch;
}

@supports (padding: max(0px)) {
    .overview {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

.overview1,
.overview2,
.overview3 {
    display: grid;
    grid-template-rows: 1fr;
    grid-template-columns: 100fr 3em 3em 1.6em 80px 1.6em 3em 3em 100fr;
    row-gap: 5px;
    column-gap: 10px;
    align-items: center;
}

.overview2,
.overview3 {
    margin-top: 5px;
}

.overview-team-home,
.overview-team-guest {
    max-width: 100px;
    white-space: nowrap;
    overflow: visible;
}

.overview-team-home {
    grid-column: 1/5;
    justify-self: right;
    text-align: right;
}

.overview-team-home .team-name,
.overview-team-home .team-other-stats {
    float: right;
}

.overview .team-home.shot-percentage {
    grid-column: 2;
    text-align: right;
}

.overview .team-home.shot-totals {
    grid-column: 3;
    text-align: right;
}

.overview .team-home.shot-points {
    grid-column: 4;
    text-align: right;
}

.overview-stats {
    grid-column: 5;
    justify-self: center;
    align-self: center;
}

.overview-team-guest {
    grid-column: 6/10;
    justify-self: stretch;
}

.overview .team-guest.shot-percentage {
    grid-column: 8;
    text-align: right;
}

.overview .team-guest.shot-totals {
    grid-column: 7;
    text-align: right;
}

.overview .team-guest.shot-points {
    grid-column: 6;
    text-align: right;
}

.overview-score {
    font-size: 24px;
    font-weight: bold;
}

.fouls-in-period {
    color: yellow;
}

.possession-indicator {
    display: inline-block;
    width: 1em;
    color: red;
    font-size: 24px;
    font-weight: bold;
}

@media screen and (max-width: 950px) {
    .players .name {
        width: 4em;
    }
}

@media screen and (max-width: 800px) {
    .play-by-play {
        row-gap: 5px;
    }

    .back-button {
        top: 2px;
        left: 2px;
    }

    .stats-players-home,
    .stats-players-guest {
        display: none;
    }

    .ticker-container {
        margin: 2px 2px 0 2px;
    }

    .ticker {
        grid-column: 1/4;
        row-gap: 7px;
    }

    .shot-clock .start-button,
    .shot-clock .end-button {
        display: none;
    }

    .shot-clock .play-button,
    .shot-clock .offset-input {
        margin-right: 2px;
    }

    .game-clock-slider {
        margin: 0 2px 0 2px;
    }

    .overview {
        margin: 0;
        border-radius: 0;
        padding: 5px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    @supports (padding: max(0px)) {
        .overview {
            padding-bottom: max(5px, env(safe-area-inset-bottom));
        }
    }
}

@media screen and (max-width: 600px) {
    .ticker .row .home {
        text-align: left;
    }

    .ticker .row .home.current-score {
        text-align: right;
    }

    .ticker .row .guest {
        text-align: right;
    }

    .ticker .row .guest.current-score {
        text-align: left;
    }

    .overview1,
    .overview2,
    .overview3 {
        grid-template-columns: 100fr 0 3em 1.6em 80px 1.6em 3em 0 100fr;
    }

    .overview2 .shot-totals {
        display: none;
    }

    .overview .team-home.shot-percentage {
        grid-column: 3;
    }

    .overview .team-guest.shot-percentage {
        grid-column: 7;
    }

    .overview3 {
        display: none;
    }
}

@media screen and (max-height: 600px) {
    .play-by-play {
        row-gap: 5px;
    }

    .stats-players-home {
        margin: 2px 0 0 2px;
        padding: 2px;
    }

    .stats-players-guest {
        margin: 2px 2px 0 0;
        padding: 2px;
    }

    .ticker {
        margin: 2px 5px 0 5px;
        row-gap: 7px;
    }

    .game-clock-slider {
        margin: 0 2px 0 2px;
    }

    .overview {
        margin: 0 2px 2px 2px;
        padding: 2px;
        padding-bottom: env(safe-area-inset-bottom);
    }

    @supports (padding: max(0px)) {
        .overview {
            padding-bottom: max(2px, env(safe-area-inset-bottom));
        }
    }

    .overview2,
    .overview3 {
        display: none;
    }
}
