.overlay {
    position: fixed;
    top: 55vh;
    left: 50%;
    transform: translate(-50%, -50vh);
    width: min(90vw, 500px);
    background-color: rgba(34, 34, 34, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: left;
    z-index: 10000;
    max-height: 90vh;
    overflow-y: auto;
}

.overlay .content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.overlay h1 {
    font-size: 24px;
    font-family: "Jersey 15", "Roboto", sans-serif;
}
.overlay h2 {
    font-size: 20px;
    font-family: "Jersey 15", "Roboto", sans-serif;
}
.overlay p {
    font-size: 16px;
    line-height: 1.4;
    margin-left: 5%;
    margin-right: 5%;
    width: 100%;
}

.overlay .content>img {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
    margin: 10px 0;
}
.overlay.fade-out {
    animation: fadeOut 1s ease-in-out forwards;
}
.overlay.fade-in {
    animation: fadeIn 1s ease-in-out forwards;
}

.buttons {
    text-align: center;
    width: 100%;
}

.buttons>button {
    display: inline-block;
}
.buttons>button:not(:last-child) {
    margin-right: 15px;
}

#level-overlay {
    --height: min(140px, calc(100vh / 4));
    --width: min(500px, 100vw);
    --font-size: calc(--height / 3);
    position: fixed;
    transform-origin: -50% -50%;
    top: 0;
    left: 0;
    transform: translate(50vw, 50vh);
    height: var(--height);
    min-width: var(--width);
    padding-left: 40px;
    padding-right: 40px;
    border-radius: 10px;
    background-color: rgba(34, 34, 34, 0.9);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    margin-left: -250px;
    margin-top: -70px;
    font-size: var(--font-size);
    font-family: "Jersey 15", "Roboto", sans-serif;
    user-select: none;
    animation: fadeOut 1s ease 1s forwards; /* Start fading out after 1s */
}
#level-overlay.complete {
    animation: fadeOut 1s ease 2.5s forwards; /* Start fading out after 1s */
}
#level-overlay h1 {
    font-size: 24px;
    font-family: "Jersey 15", "Roboto", sans-serif;
}

p>span.goal-icon {
    filter: invert() sepia(100%) saturate(1000%);
    background: url("../images/laurel-wreath.png") no-repeat center;
    background-size: contain;
    display: inline-block;
    height: 1.5rem;
    width: 1.5rem;
    vertical-align: middle;
}

#start-button {
    background-color: #C9A04D; /* Roman gold */
    color: #222;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}

#start-button:hover {
    background-color: #a6853e;
}

#help-dialog h2, #help-dialog h3 {
    margin-top: 0;
}

#help-dialog p {
    text-align: left;
}

#scoring-example {
    text-align: center;
    margin: 20px 0;
    max-height: 300px;
}

#scoring-example img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    max-height: 300px;
}

#countdown-timer {
    font-size: 18px;
    margin: 10px 0;
}

#help-dialog button {
    margin-top: 20px;
    padding: 8px 16px;
    font-size: 16px;
}

#dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#help-dialog {
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    background-color: rgba(34, 34, 34, 0.95);
    color: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 10000;
    margin-bottom: 20px;
    max-height: 100%;
    overflow-y: scroll;
}

#confirm-dialog {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    user-select: none;
}

#confirm-dialog button {
    margin: 10px;
    padding: 8px 16px;
}

#help-dialog h2 {
    margin-top: 0;
}

#help-dialog button {
    margin-top: 20px;
    padding: 8px 16px;
    font-size: 16px;
}

/* End-Game Dialogue */

#end-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

#end-game-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    text-align: center;
}

#end-game-content h2 {
    margin-top: 0;
}

#end-game-content button {
    margin-top: 20px;
    padding: 8px 16px;
    font-size: 16px;
    margin-right: 10px;
    border-radius: 20px;
    background: rgba(34, 34, 34, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
#end-game-content button:hover {
    background-color: rgba(40, 167, 69, 0.9);
}
#end-game-content .toggle-charts {
    display: flex;
    justify-content: center;
}
#end-game-content .toggle-charts>button {
    margin: 0;
    border-radius: 0;
    font-size: 12px;
    line-height: 16px;
    padding: 0;
    min-width: 60px;
    text-align: center;
}
#end-game-content .toggle-charts>button:hover {
}
#end-game-content .toggle-charts>button:first-child {
    margin: 0;
    border-bottom-left-radius: 20px;
    border-top-left-radius: 20px;
    padding-left: 3px;
}
#end-game-content .toggle-charts>button:last-child {
    margin: 0;
    border-bottom-right-radius: 20px;
    border-top-right-radius: 20px;
    padding-right: 3px;
}
#end-game-content .toggle-charts>button.toggle-on {
    filter: brightness(70%);
}
#end-game-content .toggle-charts>button.toggle-on:hover {
}

#end-game-content button#share-end-game {
    background-color: rgba(52, 152, 219, 0.8); /* Nice blue */
    color: white;
    border: none;
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 15px;
}
#end-game-content button#share-end-game:hover {
    background-color: rgba(52, 152, 219, 1);
}
#next-game-countdown {
    margin-top: 10px;
    font-size: 18px;
}

/* Style for the chart */
#history-chart {
    margin: 20px 0;
}
#histogram-chart {
    margin: 20px 0;
}

/* Android App overlay */
#android-overlay .buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 1em;
}
#android-overlay .content>img {
    max-height: 600px;
    width: 100%;
    max-width: fit-content;
}

#android-overlay #play-online-button {
    background: #cccccc;
    color: black;
}
#android-overlay #play-online-button:hover {
    background: #c1c1c1;
}

.get-it-on-google-play {
    min-height: 7.6mm;
    height: calc(2ex * 1.15 + 2 * 8px);
    /*margin: 2mm 2mm 2mm 2mm;*/
    display: inline-block;
}
.get-it-on-google-play img {
    height: 100%;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
        pointer-events: auto;
    }
}

#message-container {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(220, 53, 69, 0.9); /* Bootstrap danger color */
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 10000;
    display: none;
    font-size: 16px;
    max-width: 80%;
    text-align: center;
    pointer-events: none;
}

#debug {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #444;
    padding: 10px;
    /* Ensure the drawer is visible and on top */
    position: relative;
    z-index: 10;
    pointer-events: auto;
    font-size: 24px;
    color: white;
    align-content: center;
    min-height: 40px;
    display: none;
}

@media (max-width: 600px) {
    .overlay {
        top: 50vh;
        bottom: -50vh;
        max-height: 100vh;
    }
}