:root {
    --mobile-safe-top: env(safe-area-inset-top, 0px);
    --mobile-safe-right: env(safe-area-inset-right, 0px);
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-safe-left: env(safe-area-inset-left, 0px);
}

body.mobile-ui-active {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

body.mobile-ui-active #game-container {
    overflow: hidden;
}

#mobile-ui-root {
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
    touch-action: none;
    font-family: 'Courier New', monospace;
    color: #fff;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-user-select: none;
    user-select: none;
}

#mobile-ui-root.mobile-ui-hidden {
    display: none;
}

.mobile-ui-button,
.mobile-skill-wheel,
.mobile-release-rate-popup {
    pointer-events: auto;
    touch-action: none;
}

.mobile-ui-button {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 56px;
    min-height: 44px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    background: rgba(0, 0, 0, 0.48);
    box-shadow: 0 0 0 2px rgba(0, 48, 168, 0.65);
    padding: 6px 8px;
    color: #fff;
    font: 700 16px/1 'Courier New', monospace;
    text-shadow: 1px 1px #000;
}

.mobile-ui-button img,
.mobile-skill-icon,
.mobile-active-skill,
.mobile-digit,
.mobile-release-rate-popup img {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.mobile-hud-top-left {
    left: calc(var(--mobile-safe-left) + 10px);
    top: calc(var(--mobile-safe-top) + 10px);
}

.mobile-hud-top-right {
    right: calc(var(--mobile-safe-right) + 10px);
    top: calc(var(--mobile-safe-top) + 10px);
    min-width: 48px;
    justify-content: center;
}

.mobile-hud-bottom-left {
    left: calc(var(--mobile-safe-left) + 10px);
    bottom: calc(var(--mobile-safe-bottom) + 10px);
    display: block;
    min-width: 96px;
    line-height: 1.05;
}

.mobile-hud-bottom-right {
    right: calc(var(--mobile-safe-right) + 10px);
    bottom: calc(var(--mobile-safe-bottom) + 10px);
    min-width: 48px;
    justify-content: center;
}

.mobile-hud-bottom-right.mobile-nuke-armed {
    outline: 4px solid rgba(255, 255, 255, 0.72);
}

.mobile-icon-2x {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
}

.mobile-number-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    vertical-align: middle;
}

.mobile-digit {
    width: 16px;
    height: 16px;
}

.mobile-release-rate-popup {
    position: absolute;
    left: calc(var(--mobile-safe-left) + 18px);
    bottom: calc(var(--mobile-safe-bottom) + 78px);
    width: 128px;
    height: 96px;
}

.mobile-release-rate-popup > img {
    position: absolute;
    inset: 0;
    width: 128px;
    height: 96px;
}

.mobile-release-rate-digits {
    position: absolute;
    left: 32px;
    top: 32px;
    width: 64px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-release-rate-digits .mobile-digit {
    width: 32px;
    height: 32px;
}

.mobile-release-zone {
    position: absolute;
    left: 0;
    width: 128px;
    height: 48px;
}

.mobile-release-zone-up { top: 0; }
.mobile-release-zone-down { bottom: 0; }

.mobile-skill-wheel {
    position: fixed;
    width: 276px;
    height: 276px;
    border-radius: 50%;
    background: rgba(0, 96, 0, 0.38);
    border: 2px solid rgba(128, 255, 96, 0.72);
    box-shadow: 0 0 0 2px rgba(0, 48, 0, 0.65), 0 10px 24px rgba(0, 0, 0, 0.55);
}

.mobile-skill-choice {
    position: absolute;
    width: 72px;
    height: 87px;
    transform: translate(-36px, -43px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.mobile-skill-choice.mobile-skill-centre {
    left: 138px;
    top: 138px;
}

.mobile-skill-count {
    height: 27px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-skill-icon-wrap {
    position: relative;
    width: 48px;
    height: 48px;
}

.mobile-skill-icon,
.mobile-active-skill {
    position: absolute;
    left: 0;
    top: 0;
    width: 48px;
    height: 48px;
}

.mobile-skill-choice.mobile-skill-empty {
    opacity: 0.55;
}

.mobile-preview-hint {
    position: absolute;
    left: 50%;
    bottom: calc(var(--mobile-safe-bottom) + 12px);
    transform: translateX(-50%);
    border: 2px solid rgba(255, 255, 255, 0.72);
    background: rgba(0, 0, 0, 0.54);
    box-shadow: 0 0 0 2px rgba(0, 48, 168, 0.65);
    padding: 7px 10px;
    font: 700 14px/1 'Courier New', monospace;
    text-shadow: 1px 1px #000;
    white-space: nowrap;
}

.mobile-ui-invisible {
    display: none !important;
}

body.mobile-ui-active.mobile-map-active #game-container {
    align-items: flex-start;
}
