* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: -webkit-fill-available;
}

html, body {
    width: 100%;
    min-height: 100%;
    min-height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000;
}

#app {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: 100svh;
    overflow: hidden;
    background: #000;
    box-sizing: border-box;
    padding:
        env(safe-area-inset-top, 0)
        env(safe-area-inset-right, 0)
        env(safe-area-inset-bottom, 0)
        env(safe-area-inset-left, 0);
}

#display {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Hide <img> entirely when there is no valid source to prevent broken-image icon */
#display:not([src]),
#display[src=""] {
    display: none;
}

.overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: block;
}

.hidden {
    display: none;
}

.overlay.initial {
    max-width: 74vw;
    max-height: 30vh;
    width: auto;
    height: auto;
}

#overlayLogo.overlay.logo {
    left: 50%;
    top: 47%;
    width: min(78.75vw, 1132px);
    max-width: none;
    max-height: 78.75vh;
    height: auto;
    /* Horizontal: circle center; vertical: top shifts logo up on screen */
    transform: translate(-47.5%, -50%);
}

@media (orientation: landscape) {
    #overlayLogo.overlay.logo {
        top: 45%;
    }
}

.overlay.game-over {
    width: min(80vw, 1467px);
    max-width: none;
    max-height: 48vh;
    height: auto;
}

#contact {
    position: absolute;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    transform: translateX(-50%);
    color: #fff;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0.95;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 14px 28px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    z-index: 30;
    -webkit-appearance: none;
    appearance: none;
}

#contact:hover {
    border-color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.08);
}

@media (hover: none) {
    #contact {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    }
}

/* iPhone landscape: short viewport, keep final text and Contact separated */
@media (orientation: landscape) and (hover: none) and (max-height: 500px) {
    #overlayGameOver.overlay.game-over {
        top: 36%;
        transform: translate(-50%, -50%);
        width: min(72vw, 900px);
        max-height: 30vh;
        max-height: 30dvh;
    }

    #contact {
        bottom: calc(
            env(safe-area-inset-bottom, 0px)
            + max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px))
            + 12px
        );
        font-size: 16px;
        padding: 10px 22px;
    }

    #overlayLogo.overlay.logo {
        max-height: 62vh;
        max-height: 62dvh;
    }
}
