:fullscreen {
    --game-width: 100vw;

    background: #000;
}

.is-translating [data-i18n] {
    visibility: hidden;
}

body {
    background: #000;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

canvas {
    width: min(100%, var(--game-width));
    display: none;
}

#canvas {
    width: min(100vw, var(--game-width), 177.7778dvh);
    aspect-ratio: 16 / 9;
    image-rendering: pixelated;
}

canvas.ready {
    display: block;
}

.boss-name-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;

    display: none;
    place-items: center;
}

body:has(#canvas.ready):not(:has(.game-over:not([hidden]), .victory-screen:not([hidden]))) .boss-name-layer {
    display: grid;
}

.boss-name-frame {
    width: min(100vw, var(--game-width), 177.7778dvh);
    aspect-ratio: 16 / 9;
    container-type: inline-size;
}

.boss-name {
    margin: 0;
    padding-top: 4.6cqw;
    opacity: 0;

    font: bold 1.02cqw monospace;
    letter-spacing: 0.23cqw;
    text-align: center;
    text-transform: uppercase;
    color: rgba(255, 236, 214, 0.92);
    text-shadow:
        0 0 2px #000,
        0 0 2px #000,
        0 0 3px #000;
}

#screen-transition {
    position: fixed;
    inset: 0;
    z-index: 20;

    background: #000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 350ms ease, visibility 350ms ease;

    @media (prefers-reduced-motion: reduce) {
        transition: none;
    }
}

#screen-transition.is-visible {
    opacity: 1;
    visibility: visible;
}

.start-screen[hidden],
.pause-screen[hidden],
.game-over[hidden],
.victory-screen[hidden] {
    display: none;
}

.pause-screen {
    position: fixed;
    inset: 0;
    z-index: 9;

    background: rgba(0, 0, 0, 0.55);

    display: grid;
    place-items: center;
}

.pause-screen-content {
    width: min(var(--game-width), 100vw, 177.7778dvh);
    aspect-ratio: 16 / 9;

    color: var(--color-white);
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2.5dvh, 1rem);
}

.pause-screen-content h1,
.pause-screen-content p {
    margin: 0;
}

.game-over {
    position: fixed;
    inset: 0;
    z-index: 10;

    background: rgba(0, 0, 0, 0.85);

    display: grid;
    place-items: center;
}

.victory-screen {
    position: fixed;
    inset: 0;
    z-index: 11;

    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(0.375rem);

    display: grid;
    place-items: center;
}

.victory-screen-content {
    width: min(var(--game-width), 100vw, 177.7778dvh);
    aspect-ratio: 16 / 9;

    color: var(--color-white);
    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.victory-screen-content h1 {
    margin: 0;

    color: var(--color-accent);
    font-family: var(--font-base);
    font-size: clamp(2.5rem, min(12vw, 18dvh), 7rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-shadow: 0 0.25rem 0.5rem #000;
}

.victory-screen-stats {
    margin: 0;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1rem, 5vw, 3rem);
}

.victory-screen-stats div {
    display: grid;
    gap: 0.25rem;
}

.victory-screen-stats dt {
    color: var(--color-accent);
    font-size: clamp(0.875rem, 2vw, 1.125rem);
}

.victory-screen-stats dd {
    margin: 0;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 700;
    text-shadow: 0 0.125rem 0.375rem #000;
}

.victory-screen-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.game-over-screen {
    position: relative;
    width: min(var(--game-width), 100vw, 177.7778dvh);
    aspect-ratio: 16 / 9;
    background: url("assets/images/9_screens/game_over_screen.webp") center / 100% 100% no-repeat;
}

#game-over-character {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    filter: grayscale(0.6);
}

.game-over-actions {
    position: absolute;
    right: 0;
    bottom: 7%;
    left: 0;
    z-index: 2;

    display: flex;
    justify-content: center;
    gap: 3rem;
}

.game-over button,
.pause-screen button,
.victory-screen button {
    padding-block: clamp(0.375rem, 2dvh, 0.75rem);
    padding-inline: 1.25rem;
    border: 1px solid rgba(255, 226, 122, 0.8);
    border-radius: 0.375rem;

    background: rgba(10, 20, 24, 0.65);
    color: var(--color-accent);
    font-family: var(--font-base);
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    font-weight: 600;
    cursor: pointer;
    transition: transform 200ms ease, background 200ms ease;
}

.pause-screen button {
    width: clamp(9rem, 28vw, 14rem);
}

.game-over button:hover,
.game-over button:focus-visible,
.pause-screen button:hover,
.pause-screen button:focus-visible,
.victory-screen button:hover,
.victory-screen button:focus-visible {
    background: rgba(37, 54, 54, 0.85);
    transform: translateY(-0.1875rem);
}

.victory-screen .victory-restart-button {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: #101719;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.victory-screen .victory-restart-button:hover,
.victory-screen .victory-restart-button:focus-visible {
    background: #fff0b3;
}

@media (prefers-reduced-motion: reduce) {

    .game-over button,
    .pause-screen button,
    .victory-screen button {
        transition: none;
    }

    .game-over button:hover,
    .game-over button:focus-visible,
    .pause-screen button:hover,
    .pause-screen button:focus-visible,
    .victory-screen button:hover,
    .victory-screen button:focus-visible {
        transform: none;
    }
}

.orientation-hint {
    position: fixed;
    inset: 0;
    z-index: 30;
    padding: 1.5rem;

    background: #0a1418;
    color: var(--color-text);
    font-family: var(--font-base);
    text-align: center;

    display: none;
    place-content: center;
    justify-items: center;
    gap: 1rem;

    @media (orientation: portrait) and (max-width: 600px) {
        display: grid;
    }

    @media (min-width: 480px) and (pointer: fine) {
        display: none;
    }
}

.orientation-hint h1 {
    color: var(--color-accent);
    font-size: clamp(1.5rem, 7vw, 2rem);
}

.orientation-hint-icon {
    width: 4rem;
    height: 4rem;

    color: var(--color-accent);
    animation: rotate-device 2400ms ease-in-out infinite;

    @media (prefers-reduced-motion: reduce) {
        transform: rotate(-90deg);
        animation: none;
    }
}

dialog[open] {
    @media (orientation: portrait) and (max-width: 600px) {
        display: none;
    }

    @media (min-width: 480px) and (pointer: fine) {
        display: block;
    }
}

@keyframes rotate-device {

    0%,
    20% {
        transform: rotate(0deg);
    }

    50%,
    70% {
        transform: rotate(-90deg);
    }

    100% {
        transform: rotate(0deg);
    }
}