@font-face {
    font-family: 'LED';
    src: url('digital.ttf') format('truetype');
}

@font-face {
    font-family: 'Mono';
    src: url('JetBrainsMono-Light.ttf') format('truetype');
}

:root {
    touch-action: auto;
    height: 100%
}

*, *:before, *:after {
    box-sizing: border-box;
}

body {
    font-family: "AvenirNextCondensed-Bold", ui-sans-serif;
    height: 100dvh;
    margin: 0;
    color: white;
    background-color: #000;
    position: fixed;
    line-height: 1;
}

.container {
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.wrapper {
    position: relative;
    margin: 0 auto 1em auto;
    width: 100%;
}

#score-wrapper {
    width: 100%;
    background-color: #222;
    border-radius: 30px;
    padding: 1rem 0.5rem 0 0.5rem;
    text-align: center;
}

#score-header {
    position: relative;
    font-size: 26px;
    width: 100%;
    display: flex;
    text-transform: uppercase;
    justify-content: space-around;
    font-family: "AvenirNextCondensed-DemiBold", ui-sans-serif;
}

.home-data {
    /* padding-right: 1em; */
}
.away-data {
    /* padding-left: 1em; */
}
#score-board {
    font-size: 160px;
    display: flex;
    width: 100%;
    justify-content: space-around;

}

/* #score-header div, #score-board div {
    display: flex;
    position: relative;
    flex-basis: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    justify-content: center;
} */

#score-header div {
    position: relative;
    width: 100%;
    text-overflow: clip;
    overflow: hidden;
}

#score-board div {
    position: relative;
    letter-spacing: -10px;
    text-indent: -10px; /* to make centering work */
}

#score-board::before {
    content: "▪";
    font-family: monospace;
    position: absolute;
    font-size: 70px;
    top: 42%;
    left: 0;
    width: 100%;
    height: 100%;
    line-height: 0.7;
}

/* #score-header > #away::after, #score-header > #home::after { */
#score-header div::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, rgba(34,34,34,0) 85%, rgba(34,34,34,1) 100%);
    opacity: 1;
}


/* #score-header div.dash, #score-board div.dash {
    flex-basis: 14%;
    line-height: 0.8;
} */

#clock-wrapper, #timer-wrapper {
    min-height: 4.5rem;
    position: relative;
    display: flex;
    width: 100%;
    justify-content: space-around;
    margin-bottom: 0;
}

#clock, #clock-bg, #timer, #timer-bg {
    font-size: 66px;
    /* text-align: right; */
    position: absolute;
    font-family: "LED", monospace;
    padding-left: 1em;
    margin-bottom: 0;
}

#clock {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5" viewBox="0 0 1439 1439"><circle cx="719.375" cy="794.286" r="592.436" style="fill:none;stroke:%23FFF;stroke-width:104.17px"/><path d="M719.375 794.286V332.235v462.051ZM1078.49 1071.43 719.374 794.285" style="fill:none;stroke:%23FFF;stroke-width:104.17px"/></svg>');
    background-repeat: no-repeat;
    background-size: 0.75em 0.75em;
    background-position: -0 3px;
    text-shadow: 0 0 5px white, 0 0 20px cyan, 0 0 30px #00f;
    color: rgb(196, 255, 255);
}

#clock-bg, #timer-bg {
    position: absolute;
    z-index: -1;
    color: #333;
    text-shadow: none;
}

#timer {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5" viewBox="0 0 1439 1439"><circle cx="719.375" cy="794.286" r="592.436" style="fill:none;stroke:%23fff;stroke-width:104.17px"/><path d="M719.375 201.85V52.083 201.85Z" style="fill:none;stroke:%23fff;stroke-width:104.17px"/><path d="M529.598 52.083h379.554M1142.2 268.423l127.624 127.624" style="fill:none;stroke:%23fff;stroke-width:104.17px;stroke-linecap:butt"/><path d="M719.375 794.286V310.245c129.189 0 246.744 50.212 334.195 132.168L719.375 794.286Z" style="fill:%23fff"/></svg>');
    background-repeat: no-repeat;
    background-size: 0.75em 0.75em;
    background-position: -0 3px;
    color: #bfb;
    text-shadow: 0 0 5px #0f0, 0 0 10px #0f0;
}

#timer.end {
    color: rgb(255, 125, 152);
    text-shadow: 0 0 5px red, 0 0 10px red;
}

button {
    font-family: "AvenirNextCondensed-Bold", ui-sans-serif;
}

#log-btns, #action-btns {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 0.5rem;
}

.center {
    justify-content: center !important;
}

.btn {
    font-size: 1.2rem;
    padding: 0.5rem;
    border: 1px solid #444;
    background-color: #444;
    color: #bbb;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.0;
    font-family: "AvenirNextCondensed-DemiBold", ui-sans-serif;
    text-transform: uppercase;
    -webkit-user-select: none;
    user-select: none;
}

.log-event {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5em;
    font-weight: bold;
    border: 3px solid white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-family: "AvenirNextCondensed-Bold", ui-sans-serif;
    font-size: 20px;
    color: #fff;
}

.btn.hilite {
    background-color: white;
    color: #666;
}

.btn-home {
    background-color: #E50C17;
    flex-basis: calc(50% - 54px);
    max-width: calc(50% - 54px);
}

.btn-away {
    background-color: #1051B9;
    flex-basis: calc(50% - 54px);
    max-width: calc(50% - 54px);
}

.btn-phase {
    background-color: #329F15;
    background-color: #fff;
    color: black;
    flex-basis: 96px;
    text-shadow: none;
    justify-content: center;
}

.hidden {
    display: none;
}

.btn .team-name {
    overflow: hidden;
    text-overflow: clip;
    width:100%;
}

#modal {
    font-size: 20px;
}

#modal h2 {
    font-size: 1.4em;
    margin-top:0;
}

#modal p {
    font-family: "AvenirNextCondensed-Regular", ui-sans-serif;
    font-size: 16px;
}
#modal-fields .fields {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 0.5em;
}

#modal label {
    font-family: "AvenirNextCondensed-DemiBold", ui-sans-serif;
    flex-basis: 64px;
    font-size: 1.1em;
    line-height: 1;
    min-width: 64px;
}

#modal .button-container {
    margin-top: 1em;
    display: flex;
    justify-content: center;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    box-shadow: 0 0 4px #fff, 0 0 8px #0f0;
}

input[type="search"] {
    background-color: #333;
    color: #fff;
    border: 2px solid #fff;
    font-family: "AvenirNextCondensed-Regular", ui-sans-serif;
    /* font-family: ui-monospace, monospace; */
    font-size: 1em;
    border-radius: 8px;
    padding: 0 0.5rem;
    height: 37px;
    width: 0;
    flex: 1;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="%23fff" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"/></svg>');
    /* background-size: 16px 16px; */
    background-position: right center;
    background-repeat: none;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

input[type="color"] {
    flex-basis: 37px;
    -webkit-appearance: none;
    border: none;
    border-radius: 8px;
    min-width: 37px;
    height: 37px;
    margin-left: 8px;
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 6px;
    box-shadow: inset 0 0 4px black;
}

.log-container {
    height: 100%;
}

#log {
    /* max-width: 500px; */
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: #020;
    color: #0f0;
    font-family: "Mono", monospace;
    font-size: 18px;
    padding: 0.5em 0.75em;
    border-radius: 16px;
    /* flex-grow: 1; */
    overflow-y: auto;
    line-height: 1.25;
    flex-wrap: nowrap;
    align-content: flex-start;
    height: 100%;
    gap: 0 0.5em;
    align-items: stretch;
    touch-action: pan-y;
    top: 0;
    bottom: 0;
    position: absolute;
}

#log div {
    width: 100%;
    letter-spacing: -1px;
    text-wrap: nowrap;
    overflow-x: clip;
}

#log div:last-of-type {
    color: rgb(215, 255, 215);
}

#log div::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, rgba(0,34,0,0) 90%, rgba(0,34,0,1) 100%);
    opacity: 1;
}

.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: none;
}

.btn:not(.log-event):active {
    background-color: #666;
    color: white;
}

.btn-home:active, .btn-away:active, .btn-phase:active {
    opacity: 0.75;
}

.modal {
    backdrop-filter: blur(8px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #222;
    color: white;
    padding: 0.5em;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    border: 1px solid #333;
}

@media screen and (min-width: 360px) {
    #clock-wrapper, #timer-wrapper {
        min-height: 5rem;
    }

    #clock, #clock-bg, #timer, #timer-bg {
        font-size: 72px;
    }
}

@media screen and (min-width: 376px) {
    #clock, #clock-bg, #timer, #timer-bg {
        font-size: 80px;
    }

    .btn-home span, .btn-away span {
        padding: 0 0.15em;
    }
    .btn-phase {
        flex-basis: 20%;
    }
}

@media screen and (min-width: 480px) {
    #clock-wrapper, #timer-wrapper {
        min-height: 6rem;
    }

    #clock, #clock-bg, #timer, #timer-bg {
        font-size: 96px;
    }
}

/* iPad 6th gen */
@media screen and (min-width: 768px) {
    #score-header {
        font-size: 50px;
    }

    #score-board {
        font-size: 280px;
        line-height: 240px;
        padding-top: 1.25rem;
    }

    #clock-wrapper, #timer-wrapper {
        min-height: 160px;
    }

    #clock, #clock-bg, #timer, #timer-bg {
        font-size: 160px;
    }

    .btn {
        padding: 1rem;
    }

    .btn-home, .btn-away {
        flex-direction: row;
        justify-content: center;
        flex-basis: 40%;
        font-size: 2em;
    }

    .btn .team-name {
        width: auto;
    }

    .btn-phase {
        font-size: 1.7rem;
    }
    #log {
        flex-wrap: wrap;
    }

    #log div {
        width: 50%;
    }
    #score-board::before {
        top:48%;
    }

}

@media (hover: hover) {
    .btn:not(.log-event):hover {
        background-color: #666;
        color: white;
    }

    .btn-home:hover, .btn-away:hover, .btn-phase:hover {
        opacity: 0.75;
    }
}

#orientation {
    width: 100%;
    height: 100%;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    background-color: #000;
    display: none;
    color: white;
    justify-content: center;
}

#orientation svg {
    width: 40%;
}

@media screen and (orientation: landscape) {
    #orientation {
        display: flex;
    }
}
