/* Google font for menu and dialogs */
@font-face {
    font-family: 'PressStart2P';
    src: url('PressStart2P-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

/* Disable text selection across the whole page */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html,
body {
    overflow: hidden;
    display: block;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background-color: black;
    font-family: "Roboto Mono", monospace;
    color: white;
}

@media (max-width: 639px) and (max-height: 479px) {
    .popup-btn {
        font-size: 10px;
    }
}

@media (min-width: 640px) and (min-height: 480px) {
    .popup-btn {
        font-size: 16px;
    }
}

.hidden {
    display: none !important;
}

#MainContainer {
    container-type: size;
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
}

#GameWindow {
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-grid {
    flex: 1 1 0;
    display: grid;
    height: 100%;
    width: 100%;
}

.btn-container {
    container-type: size;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    image-rendering: pixelated;
    background-repeat: no-repeat;
    background-image: url("buttons.png");

    /* fit item to parent, but keep 1:1 aspect-ratio */
    width: min(100cqw, 100cqh);
    height: min(100cqw, 100cqh);

    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    /* remove mobile tap highlight */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: 0;
}

#SpriteSheetImg {
    display: none;
}

#GameContainer {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* GameFrame must be positioning context for the PopUp overlay */
#GameFrame {
    width: 100%;
    height: 100%;
    border-radius: 1px;
    margin: 0;
    padding: 0;
}

.border-full-vertical {
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 2px solid white;
}

.border-small-vertical {
    border-left: 2px solid white;
    border-right: 2px solid white;
    border-top: none;
    border-bottom: 2px solid white;
}

.border-full-horizontal {
    border-left: 2px solid white;
    border-right: 2px solid white;
    border-top: none;
    border-bottom: none;
}

.border-small-horizontal {
    border-left: 2px solid white;
    border-right: none;
    border-top: 2px solid white;
    border-bottom: 2px solid white;
}

/* Overlay covers all of MainContainer (panels + game) */
#PopUp {
    position: absolute;
    inset: 0;
    z-index: 999;

    background: rgba(0, 0, 0, 0.35);
    /* backdrop */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inner window (we will size/position via JS to match GameFrame) */
#PopUp .popup-window {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid white;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;

    font-family: "PressStart2P", monospace;
}

/* Centered dialog content */
#PopUp .popup-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;

    text-align: center;
    line-height: 1.6;
}

/* Buttons row for Yes/No */
#PopUp .popup-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Generic popup button */
#PopUp .popup-btn {
    background: transparent;
    border: 2px solid currentColor;
    color: white;
    padding: 10px 12px;
    cursor: pointer;

    font-family: "PressStart2P", monospace;
    line-height: 1;

    -webkit-tap-highlight-color: transparent;
    appearance: none;
    outline: none;
    box-sizing: border-box;
}

/* Menu list container */
#PopUp .popup-menu {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

/* Menu item buttons */
#PopUp .popup-menu-btn {
    width: 100%;
    text-align: left;
    color: white;
    border-color: white;
}