:root {
    --codex-safe-top: env(safe-area-inset-top, 0px);
    --codex-safe-right: env(safe-area-inset-right, 0px);
    --codex-safe-bottom: env(safe-area-inset-bottom, 0px);
    --codex-safe-left: env(safe-area-inset-left, 0px);
    --codex-viewport-width: 100vw;
    --codex-viewport-height: 100vh;
    --codex-usable-width: calc(var(--codex-viewport-width) - var(--codex-safe-left) - var(--codex-safe-right));
    --codex-usable-height: calc(var(--codex-viewport-height) - var(--codex-safe-top) - var(--codex-safe-bottom));
    --codex-game-width: 900;
    --codex-game-height: 700;
}

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

body {
    box-sizing: border-box;
    padding-top: var(--codex-safe-top) !important;
    padding-right: var(--codex-safe-right) !important;
    padding-bottom: var(--codex-safe-bottom) !important;
    padding-left: var(--codex-safe-left) !important;
}

canvas.emscripten {
    aspect-ratio: var(--codex-game-width) / var(--codex-game-height);
    transform: translateZ(0);
    transform-origin: center center;
}

#infobox {
    box-sizing: border-box;
    max-width: min(calc(var(--codex-usable-width) - 32px), 560px);
}

#codex-exit-button {
    position: fixed;
    top: calc(var(--codex-safe-top) + 16px);
    right: calc(var(--codex-safe-right) + 16px);
    box-sizing: border-box;
    min-width: 96px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: rgba(24, 40, 58, 0.92);
    color: #f4f8fc;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 14px 34px rgba(14, 22, 32, 0.24);
    z-index: 999998;
    text-align: center;
    cursor: pointer;
}

#codex-exit-button[hidden] {
    display: none !important;
}

#codex-desktop-notice {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(calc(var(--codex-usable-width) - 24px), 420px);
    box-sizing: border-box;
    padding: 22px 22px 20px;
    border-radius: 24px;
    background: rgba(24, 40, 58, 0.96);
    color: #f4f8fc;
    box-shadow: 0 22px 48px rgba(14, 22, 32, 0.28);
    z-index: 999999;
    text-align: center;
}

#codex-desktop-notice[hidden] {
    display: none !important;
}

.codex-desktop-notice__title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.35;
}

.codex-desktop-notice__body {
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.55;
    color: rgba(244, 248, 252, 0.88);
}

.codex-desktop-notice__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    min-width: 168px;
    border-radius: 999px;
    padding: 12px 18px;
    background: #ffd968;
    color: #1f2730;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
}
