:root {
    --game-start-backdrop: rgb(32 32 32 / 96%);
    --game-start-text: #fff;
    --game-start-accent: #ff8900;
    --game-start-ink: #111;
    --game-start-width: 37.5rem;
    --game-start-gap: 1.5rem;
    --game-start-radius: 999rem;
    --game-mobile-aspect: 0.5625; /* Upright 9:16 playfield in landscape hosts. */
}

.game-surface {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* Separate from the canvas so every HUD element sits below the same backdrop. */
.game-start {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--game-start-gap);
    box-sizing: border-box;
    background: var(--game-start-backdrop);
    color: var(--game-start-text);
    font-family: 'Alan Sans', Inter, Arial, sans-serif;
}

.game-start[hidden] {
    display: none;
}

/* Auto margins center tall screens but leave short screens fully scrollable. */
.game-start__content {
    width: 100%;
    max-width: var(--game-start-width);
    margin: auto;
}

.game-start__image {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: var(--game-start-gap);
}

.game-start__image[hidden] {
    display: none;
}

.game-start__instructions {
    margin: 0 0 var(--game-start-gap);
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.game-start__status {
    margin: 0 0 var(--game-start-gap);
    font-size: 16px;
    line-height: 1.5;
}

.game-start__status:empty {
    display: none;
}

.game-start__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--game-start-gap);
}

.game-start__button {
    width: min(100%, 20rem);
    min-height: 3.5rem;
    padding: 0.65rem 1.5rem;
    border: 0;
    border-radius: var(--game-start-radius);
    background: var(--game-start-accent);
    color: var(--game-start-ink);
    font: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.game-start__button--exit {
    background: var(--game-start-text);
    font-weight: 400;
}

.game-start__button:focus-visible {
    outline: 3px solid var(--game-start-accent);
    outline-offset: 5px;
}

.game-start__button:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* Submission controls share the canvas parent and remain reachable on narrow screens. */
.game-end__button {
    position: absolute;
    z-index: 20;
    top: 62%;
    left: 50%;
    max-width: calc(100% - 2rem);
    min-height: 2.75rem;
    transform: translateX(-50%);
    white-space: normal;
}

/* A portrait canvas, not a rotated canvas: pointer axes remain unchanged. */
@media (max-width: 749px), (pointer: coarse) {
    .game-end__button {
        top: auto;
        bottom: 10%;
    }

    .game-surface {
        max-width: calc(100vh * var(--game-mobile-aspect));
        max-width: calc(100dvh * var(--game-mobile-aspect));
        height: 100dvh;
        margin-inline: auto;
        touch-action: none;
    }

    .game-start {
        max-width: calc(100vh * var(--game-mobile-aspect));
        max-width: calc(100dvh * var(--game-mobile-aspect));
        margin-inline: auto;
        padding: 1rem;
    }
}
