@font-face {
    font-family: "C64Pro";
    src: url("../fonts/C64_Pro-STYLE.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html, body {
    margin: 0;
    padding: 0;
    background: #FFFFFF;
    font-family: Verdana, Arial, sans-serif;
    font-size: 14px;
}

h1, h2, h3 {
    margin-top: 0;
    font-weight: normal;
    color: #000000;
}

h1 {
    font-size: 20px;
}

h2, h3 {
    font-size: 16px;
}

.page {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

.logo {
    width: 80%;
    max-width: 500px;
    height: auto;
    display: block;
    margin-bottom: 20px;
}

.game-wrapper {
    position: relative;
    width: 95vw;
    max-width: 800px;
    height: calc(95vw * 11 / 16);
    max-height: 550px;
    background: #000;
    border: #000 4px solid;
    box-sizing: border-box;
}

#startOverlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#startScreen {
    width: 100%;
    height: 100%;
    /* the start screen is 800x450; the black strip below matches the score bar */
    background: #000 url("../GFX/start.gif") center top / 100% auto no-repeat;
    cursor: pointer;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;

    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.instructions {
    width: 90%;
    max-width: 500px;
    text-align: left;
    background: #eeeeee;
    padding: 20px 20px 10px 20px;
    margin-top: 40px;
    line-height: 20px;
}

/* name form shown over the game-over screen (positions follow the 800x550 canvas) */
#gameOverPanel {
    position: absolute;
    left: 0;
    right: 0;
    top: 52.8%; /* of the 550px canvas height */
    text-align: center;
    font-family: "C64Pro", monospace;
    font-size: clamp(9px, 1.8vw, 14px);
    color: #FFFFFF;
    z-index: 5;
}

#gameOverPanel[hidden], #scoreForm[hidden] {
    display: none;
}

#gameOverPanel label {
    display: block;
    margin-bottom: calc(0.8em + 10px);
    color: #FFD700;
}

#gameOverPanel .row {
    display: flex;
    justify-content: center;
    gap: 0.6em;
}

#gameOverPanel input,
#gameOverPanel button {
    font: inherit;
    padding: 0.4em 0.6em;
    border: 2px solid #FFFFFF;
    background: #000000;
    color: #FFFFFF;
}

#gameOverPanel input {
    width: 13ch;
}

#gameOverPanel button {
    cursor: pointer;
}

#gameOverPanel button:hover,
#gameOverPanel button:focus {
    background: #FFFFFF;
    color: #000000;
}

#scoreStatus {
    margin: 0.8em 0 0;
    min-height: 1.2em;
}

.halloffame {
    width: 90%;
    max-width: 500px;
    text-align: left;
    padding: 20px;
    margin-top: 35px;
    background: #945731; /* the brown of the mountains */
    color: #FFFFFF;
    font-family: "C64Pro", monospace;
    font-size: 14px;
}

.halloffame h2 {
    color: #FFFFFF;
    text-align: center;
}

.halloffame ol {
    width: fit-content; /* centered as a block; the rows stay aligned with each other */
    margin: 0 auto;
    padding-left: 2.5em;
    line-height: 24px;
}

.halloffame li span {
    display: inline-block;
}

.halloffame .name {
    width: 14ch;
}

.halloffame li:first-child:not(.empty) {
    color: #FFD700;
}

/* the player's own score when it is below the rows shown */
.halloffame li.me {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 2px dotted #838383;
}

/* "Hall of Fame | Top 100": the active view is white, the other one dimmed */
.hof-tabs span {
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0.4em;
}

.hof-tabs button {
    font: inherit;
    padding: 0;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.hof-tabs button:hover,
.hof-tabs button:focus-visible,
.hof-tabs button.active {
    color: #FFFFFF;
}

.hof-tabs button.active {
    cursor: default;
}

.changes, .story {
    width: 90%;
    max-width: 500px;
    text-align: left;
    padding: 10px 20px;
    margin: 10px 0;
    line-height: 20px;
    color: #333333;
}

.cookies {
    margin-top: 70px;
}

.cookies,
.cookies a {
    color: #888888;
    font-size: 12px;
}

@media (min-width: 842px) {
    .game-wrapper {
        height: 550px;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #000 !important;
        overflow: hidden;
    }

    .page {
        height: 100svh;
        width: 100vw;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0 !important;
        margin: 0 !important;
    }

    .logo, .instructions, .story, .halloffame {
        display: none !important;
    }

    .game-wrapper {
        height: 100%;
        width: auto;
        aspect-ratio: 16 / 11;
        max-width: 100vw;
        border: none;
        background: #000;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    canvas {
        height: 100% !important;
        width: auto !important;
        max-width: 100%;
        object-fit: contain;
    }
}
