/* Mobile-first stylesheet */
/* Have a look at the "min-width" media query for desktop styles */

html {
    position: relative;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;
    background-color: black;
    color: white;
    max-width: 640px;
    margin: auto;
    padding: 0 20px;
    text-align: center;
    min-height: 100vh;
    align-content: center;
    text-shadow: -1px -1px 0 #000,
                 0 -1px 0 #000,
                 1px -1px 0 #000,
                 1px 0 0 #000,
                 1px 1px 0 #000,
                 0 1px 0 #000,
                 -1px 1px 0 #000,
                 -1px 0 0 #000;
    letter-spacing: 1px;
    font-size: 14px;
    line-height: 21px;
    position: relative;
    color-scheme: dark;
}

body.page-not-found, body.about-page {
    background: #181818;
    text-shadow: none;
    letter-spacing: normal;
}

body.page-not-found img {
    max-width: 100%;
}

#background-image {
    position: fixed;
    z-index: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-attachment: scroll; /* Safari on iOS doesn't like "fixed" background-attachments */
    opacity: 50%;
}

#content, #settings, #cvars {
    position: relative;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    align-content: center;
}

#content {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

h1, h2 {
    font-size: 18px;
    line-height: 24px;
    text-align: center;
    margin: 1em 0;
}

body.landing-page h1 {
    margin-bottom: 1.5em;
}

h1 img {
    vertical-align: -2px;
    margin-right: 5px;
}

a.button {
    display: block;
}

body.landing-page a.button {
    max-width: 340px;
    margin: 20px auto;
    padding: 10px 20px;
    box-sizing: border-box;
    letter-spacing: 1px;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
}

body.landing-page .subtitle {
    font-size: 14px;
    font-weight: normal;
    letter-spacing: normal;
}

p.footnote {
    margin: 0;
}

p.footnote a {
    text-decoration: none;
    color: #a0a0a0;
}

p.footnote a:hover {
    color: #d0d0d0;
}

#home-button {
    border-radius: 0 0 5px 5px;
    width: fit-content;
    margin: 0 auto;
}

#home-button img {
    vertical-align: -2px;
}

.info {
    display: grid;
    grid-template-columns: auto auto;
    width: fit-content;
    grid-gap: 5px;
    margin: 2em auto;
    text-align: left;
}

.status img {
    vertical-align: bottom;
    filter: drop-shadow(0 0 2px black);
}

.bonus-info {
    color: #a0a0a0;
    font-size: 14px;
    font-weight: normal;
}

.player-list {
    font-weight: bold;
    font-size: 18px;
}

.player-list {
    margin: 0 auto;
    border-spacing: 10px 20px;
}

th {
    font-size: 14px;
}

.black {
    color: black;
}
.red {
    color: red;
}
.green {
    color: limegreen;
}
.yellow {
    color: yellow;
}
.blue {
    color: blue;
}
.cyan {
    color: cyan;
}
.magenta {
    color: magenta;
}
.white {
    color: white;
}
.orange {
    color: orangered;
}
.gray {
    color: gray;
}

.red, .green, .yellow, .cyan, .magenta, .white, .orange, .grey {
    text-shadow: -1px -1px 0 #000,
                 0 -1px 0 #000,
                 1px -1px 0 #000,
                 1px 0 0 #000,
                 1px 1px 0 #000,
                 0 1px 0 #000,
                 -1px 1px 0 #000,
                 -1px 0 0 #000;
}

.black, .blue {
    text-shadow: -1px -1px 0 rgba(255, 255, 255, 0.5),
                 0 -1px 0 rgba(255, 255, 255, 0.5),
                 1px -1px 0 rgba(255, 255, 255, 0.5),
                 1px 0 0 rgba(255, 255, 255, 0.5),
                 1px 1px 0 rgba(255, 255, 255, 0.5),
                 0 1px 0 rgba(255, 255, 255, 0.5),
                 -1px 1px 0 rgba(255, 255, 255, 0.5),
                 -1px 0 0 rgba(255, 255, 255, 0.5);
}

td {
    text-align: right;
}

td:first-child {
    text-align: left;
    word-break: break-word;
}

footer {
    padding-bottom: 20px;
}

#refreshed-footer {
    margin-top: 2em;
}

#refreshed-footer, #settings-footer, #settings, #cvars {
    display: none; /* Displayed by JavaScript */
}

#settings-footer {
    margin-bottom: 0;
}

#settings-footer button {
    margin: 0 5px 15px;
}

#setting-grid {
    display: grid;
    grid-template-columns: auto; /* Only 1 column in mobile view */
    grid-gap: 5px;
    text-align: left;
    width: fit-content;
    margin: auto;
}

#cvar-container {
    max-height: calc(100vh - 220px);
    overflow-y: scroll;
    background-color: rgba(0, 0, 0, 0.67);
    border: 10px solid transparent;
    border-right: 0;
    border-radius: 5px;
    padding-right: 10px;
}

#cvar-table {
    border-collapse: collapse;
    width: 100%;
}

#cvar-table th {
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    padding: 5px;
}

#cvar-table td {
    text-align: left;
    padding: 5px;
    word-break: break-word;
    min-width: 90px;
}

#cvar-table tr:nth-child(odd) th, #cvar-table tr:nth-child(odd) td {
    background: rgba(255, 255, 255, 0.1);
}

#cvars {
    max-height: 100vh;
}

label {
    font-weight: bold;
    text-align: right;
}

label strong {
    font-weight: bold; /* Not "bolder" */
}

#setting-grid label {
    margin-top: 14px;
    text-align: left;
}

#close-settings, #close-cvars {
    margin-top: 32px;
}

select, button, a.button {
    padding: 5px 10px;
    color: white;
    background: #404040;
    background: rgba(128, 128, 128, 0.5);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 5px;
    box-shadow: 0 0 2px black;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Adjusted", "Segoe UI", "Liberation Sans", sans-serif;
    font-size: 16px;
    line-height: 20px;
    max-width: 280px;
    cursor: pointer;
    text-decoration: none;
}

button:hover, a.button:hover,
button:focus, a.button:focus {
    background: rgba(192, 192, 192, 0.5);
}

select:hover, select:focus {
    background: #606060;
}

button:active, a.button:active {
    background: rgba(64, 64, 64, 0.5);
    color: #c0c0c0;
}

button:active img, a.button:active img {
    opacity: 75%;
}

button, a.button {
    font-weight: 600;
    letter-spacing: normal;
    text-shadow: none;
    padding: 10px 20px;
}

button img, a.button img {
    vertical-align: -5px;
    margin-right: 5px;
}

input[type=range], input[type=color] {
    vertical-align: middle;
}

.disabled {
    opacity: 50%;
}

h2 img {
    vertical-align: -6px;
    margin-right: 5px;
    filter: drop-shadow(0 0 2px black);
}

body.about-page {
    text-align: left;
}

body.about-page h2, body.about-page h3, body.about-page h4, body.about-page h5, body.about-page h6 {
    text-align: left;
    margin-top: 1.5em;
    margin-bottom: 0.667em;
}

body.about-page #main-content a {
    color: #a0a0ff;
    text-decoration: underline;
}

/***************/
/* Desktop CSS */
/***************/
@media (min-width: 640px) {
    body, .bonus-info {
        font-size: 16px;
        line-height: 24px;
    }

    h1, h2 {
        font-size: 24px;
        line-height: 32px;
    }

    h1 img, h2 img {
        width: 32px;
        height: 32px;
        margin-right: 10px;
        vertical-align: -7px;
    }

    select, button, a.button {
        max-width: none;
    }

    body.page-not-found h1 {
        font-size: 32px;
        line-height: 32px;
    }

    body.landing-page a.button {
        width: 340px;
        padding: 12px 20px;
        font-size: 18px;
        line-height: 24px;
    }

    .status img {
        width: 24px;
        height: 24px;
    }

    .info {
        grid-gap: 5px 10px;
    }

    .player-list {
        font-size: 24px;
        line-height: 24px;
    }

    th {
        font-size: 18px;
    }

    #settings h2 {
        margin-bottom: 2em;
    }

    #setting-grid {
        grid-template-columns: auto auto;
        grid-gap: 10px;
    }

    #setting-grid label {
        margin-top: 0;
        text-align: right;
    }

    #cvar-table {
        max-height: calc(100vh - 230px); /* 10px shorter in desktop mode */
    }
}

/*************/
/* Print CSS */
/*************/
@media print {
    body, body.page-not-found, #background-image, #cvar-container {
        background-image: none !important;
        background-color: white !important;
    }

    /* Hide some stuff */
    header, footer, #close-settings, #close-cvars {
        display: none;
    }

    body {
        color: black;
        text-shadow: none;
    }

    h2 img, .status img {
        filter: none; /* No drop shadow */
    }

    .black, .red, .green, .yellow, .blue, .cyan, .magenta, .white, .orange, .grey {
        text-shadow: none;
    }

    .white, .player-list .white {
        color: black;
        font-weight: normal;
    }

    select, button, a.button {
        color: black;
        background: white;
        border: 1px solid #808080;
        box-shadow: none;
    }

    #settings h2 img {
        filter: invert(100%);
    }

    #cvar-container {
        max-height: none;
        overflow-y: visible;
    }

    #cvar-table th {
        font-size: 16px;
    }
}
