@font-face{
  font-family: GameFont;
  src: url("./fonts/OMORI_GAME2.ttf");
}

body{
  position: relative;
  padding: 0;
  margin: 0;
  background-color: black;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background-image: url("./sprites/others/sky.png");

  background-repeat: repeat;
  background-position: 100% 0; 
  animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
  0% {
    background-position: 100% 0; 
  }
  100% {
    background-position: 50% 100%;
  }
}

#disclamer{
  background-color: black;
  position: absolute;
  display: flex;
  justify-self: center;
  align-content: center;
  flex-direction: column;
  width: 100%;
  height: 100%;
  z-index: 4;
}

#disc-text{
  display: flex;
  justify-self: center;
  align-content: center;
  width: 100%;
  height: 80%;
}

#d-text{
  font-family: GameFont, sans-serif;
  font-size: 7vh;
  color: rgb(255, 255, 255);
  margin: auto;
  width: 70%;
  height: 60%;
  text-align: center;
  animation: 3s fading forwards;
  user-select: none;
}

@media  (max-width: 1554px) {
  #d-text{
    font-size: 5vh;
  }
}

@media  (max-width: 1000px) {
  #d-text{
    font-size: 3vh;
  }
}

@media  (max-width: 260px) {
  #d-text{
    font-size: 2vh;
  }
}

#caution{
  background-color: rgb(190, 187, 187);
  color: rgb(0, 0, 0);
  font-weight: bold;
  padding: 0 10px;
}

#game-link a{
  text-decoration: none;
  font-weight: bold;
  color: red;
}

#disc-button{
  display: flex;
  justify-self: center;
  align-content: center;
  width: 100%;
  height: 20%;
}

#d-button{
  font-family: GameFont, sans-serif;
  font-size: 33px;
  text-align: center;
  color: rgb(226, 226, 226);
  background-color: #000000;
  outline: 3px solid white;
  margin: auto;
  width: 4.5em;
  height: 1.3em;
  position: relative;
  cursor: pointer;
  border-radius: 1px;
  transition: transform 0.3s;
  animation: 3s fading forwards;
  user-select: none;
}

#d-button:hover{
  transform: scale(1.05);
}


@keyframes fading {
  0%    {opacity: 0;}
  100%  {opacity: 1;}
}

@keyframes fading-rev {
  0%    {opacity: 1;}
  100%  {opacity: 0;}
}

@keyframes fading-bc-rev {
  0%    {opacity: 1;}
  100%  {opacity: 0;}
}

#bg-wrap{
  position: absolute;
  overflow: hidden;
}

#bg-wrap img{
  overflow: hidden;
}

#game-containe-wrap{
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  z-index: 3;
 
}

.game-container{
  position: relative;
  width: 480px;
  height: 640px;
  /* outline: 1px solid white; */
  transform: scale(1.4);
  transform-origin: top left;
}

/* ensure canvas uses crisp pixel scaling */
.game-container canvas{
  image-rendering: pixelated;
}

#discript-wrapper{
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  bottom: 3%;
  width: 100%;
  height: 28%;
}

.discription {
  background-color: #000000;
  position: absolute;
  flex-direction: column;
  width: 125%;
  height: 0%;
  overflow: hidden;
  outline: solid #FFFFFF;
  border: solid black 3px;
  justify-content: space-between;
  animation: open 0.1s linear forwards;
}

.discription.closing {
  animation: close 0.1s linear forwards;
}

@keyframes open {
  0%{
    height: 0%;
  }
  100%{
    height: 65%;
  }
}

@keyframes close {
  0%{
    height: 65%;
  }
  100%{
    height: 0%;
  }
}

#text-div-wrap{
  display: inline-block
}

#text-div{
  font-family: GameFont, sans-serif;;
  font-size: 33px;
  padding-left: 15px;
  color: #FFFFFF;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  animation: 
    typing 1s steps(20),
    cursor .4s step-end infinite alternate;
}

@keyframes cursor {
  50%{ border-color: transparent;}
}

@keyframes typing {
  from{ width: 0;}
}

#img-div {
  position: absolute; 
  bottom: 0; 
  display: flex;
  justify-content: flex-end;
  width: 100%;
  height: 23%;
}

#pointer{
  margin-right: 30px;
  width: 40px;
  height: 20px;
  animation: movePointer 1s ease-in-out infinite;
}

#pointer2{
  width: 5vh;
  height: 2.5vh;
  animation: movePointer2 1s ease-in-out infinite;
}

@keyframes movePointer {
  0% {
    transform: translateX(0); 
  }
  50% {
    transform: translateX(10px); 
  }
  100% {
    transform: translateX(0); 
  }
}

@keyframes movePointer2 {
  0% {
    transform: translateX(0); 
  }
  50% {
    transform: translateX(1vh); 
  }
  100% {
    transform: translateX(0); 
  }
}

#menu{
  width: 100%;
  height: 100%;
  background-color: #522e2e62;
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

#title-sprite{
  display: flex;
  justify-content: center;
  width: 100%;
  height: 30%;
  pointer-events: none;
  user-select: none;
}

#title-anim{
  display: flex;
  justify-content: center;
  position: absolute;
  width: 90%;
  height: 30%;
  pointer-events: none;
  user-select: none;
}

#sunny-sprite{
  display: flex;
  justify-content: center;
  width: 100%;
  height: 70%;
  pointer-events: none;
  user-select: none;
}

#menu-buttons-wrap{
  width: 100%;
  height: 100%;
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#top-bar {
  position: relative;
  display: flex;

  width: 100%;
  height: 10%;

  justify-content: end;
  align-items: center;
}

#guide{
  display: flex;
  margin-right: 1vh;
  position: relative;

  font-family: GameFont, sans-serif;
  font-size: 6vh;
  color: rgb(0, 0, 0);
  padding-left: 1%;
  font-weight: bold;

  cursor: pointer;
  text-decoration: none;
  user-select: none;
  animation: 3s fading forwards;
}


#guide-info-wrap{
  position: relative;
  width: 50vh;
  height: 5vh;
}

#guide-info{
  position: absolute;
  width: 50vh;
  height: 50vh;
  top: -60vh;

  background-color: black; 
  border: 0.5vh solid white; 
  outline: 0.2vh solid black;
  
  animation: slideDown 0.5s forwards;

  user-select: none;
  text-decoration: none;
  pointer-events: none;
}

#guide-info img{
  width: 100%;
  height: 100%;
  user-select: none;
  text-decoration: none;
  pointer-events: none;
}


@keyframes slideDown {
  0%{
    top: -60vh;
  }
  100%{
    top: 0px;
  }
}

@keyframes slideUp {
  0%{
    top: 0px;
  }
  100%{
    top: -60vh;
  }
}

#bottom-bar {
  width: 100%;
  height: 10%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#bot-button-wrapper{
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40%;
  height: 60%;
}

.m-button{
  display: flex;
  justify-content: center; 
  align-items: center; 

  width: 25%;
  height: 90%;

  font-family: GameFont, sans-serif;
  font-size: 5vh;
  color: rgb(226, 226, 226);
  padding-left: 1%;
  font-weight: bold;
  
  background-color: black; 
  border: 0.5vh solid white; 
  outline: 0.2vh solid black;

  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s;
  animation: 3s fading forwards;
}

#g-link a{
  text-decoration: none;
  font-weight: bold;
  color: red;
}

#git-link a{
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  color: rgb(255, 255, 255);
}

.m-button:hover {
  transform: scale(1.05);
}

@media  (max-width: 1700px) {
  .m-button{
    font-size: 4.5vh;
  }
}

@media  (max-width: 1550px) {
  .m-button{
    font-size: 4vh;
  }
}

@media  (max-width: 1400px) {
  .m-button{
    font-size: 3.5vh;
  }
}

@media  (max-width: 1200px) {
  .m-button{
    font-size: 3vh;
  }
}

#black-screen{
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  background-color: black;
  animation: 3s fading forwards;
  
}

/* Character selector (top-right) */
/* Tip button sits to the left of the character selector */
#tip-button {
  position: absolute;
  top: 1.2vh;
  right: calc(1.2vh + 16.2vh); /* place left of #char-select which is ~14vh + margins */
  z-index: 7;
  display: none; /* will be shown when game starts via JS observer */
}

/* ensure tip button visible when char-select shows; JS inserts and auto-manages display */
#tip-button[style] { display:flex; }

/* simple mobile-safe adjustments for tip button */
@media (max-width: 900px) {
  #tip-button { right: calc(1.2vh + 16.2vh); bottom: auto; top: 1.2vh; }
}

/* Character selector container */
#char-select{
  position: absolute;
  top: 1.2vh;
  right: 1.2vh;
  width: 14vh;
  background: rgba(0,0,0,0.8);
  border: 0.4vh solid #fff;
  outline: 0.15vh solid #000;
  padding: 0.5vh;
  z-index: 6;
  user-select: none;
  font-family: GameFont, sans-serif;
  color: #fff;
  /* Hide until the player presses PLAY */
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.5vh;
}

#char-select-title{
  font-size: 2.2vh;
  font-weight: bold;
  text-align: center;
  width: 100%;
  border-bottom: 0.1vh solid rgba(255,255,255,0.15);
  padding-bottom: 0.6vh;
}

#char-options{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4vh;
  width: 100%;
  align-items: center;
  justify-items: center;
}

.char-option{
  width: 5.8vh;
  height: 5.8vh;
  background: #0a0a0a;
  border: 0.2vh solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s;
}

.char-option img{
  max-width: 90%;
  max-height: 90%;
  image-rendering: pixelated;
  display: block;
  pointer-events: none;
}

.char-option.selected{
  transform: scale(1.05);
  border-color: #fff;
}

/* NPC control box (placed above char-select) */
#npc-control {
  position: absolute;
  bottom: 1.2vh;
  right: 1.2vh;
  width: 14vh;
  background: rgba(0,0,0,0.85);
  border: 0.4vh solid #fff;
  outline: 0.15vh solid #000;
  padding: 0.4vh;
  z-index: 7;
  font-family: GameFont, sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.4vh;
  align-items: center;
  user-select: none;
}

#npc-control .npc-buttons {
  display: flex;
  width: 100%;
  gap: 0.4vh;
  justify-content: space-between;
}

.npc-btn {
  flex: 1;
  background: #0a0a0a;
  border: 0.2vh solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.6vh;
  padding: 0.3vh;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.npc-count {
  font-size: 1.6vh;
  width: 100%;
  text-align: center;
}

/* Wanderer control (bottom-left) */
#wander-control {
  position: absolute;
  bottom: 1.2vh;
  left: 1.2vh;
  width: 14vh;
  background: rgba(0,0,0,0.85);
  border: 0.4vh solid #fff;
  outline: 0.15vh solid #000;
  padding: 0.4vh;
  z-index: 7;
  font-family: GameFont, sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.4vh;
  align-items: center;
  user-select: none;
}

#wander-control .wander-buttons {
  display: flex;
  width: 100%;
  gap: 0.4vh;
  justify-content: space-between;
}

.wander-btn {
  flex: 1;
  background: #0a0a0a;
  border: 0.2vh solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.6vh;
  padding: 0.3vh;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.wander-count {
  font-size: 1.6vh;
  width: 100%;
  text-align: center;
}

/* Chat UI (top-left) */
#chat-wrapper {
  position: absolute;
  top: 1.2vh;
  left: 1.2vh;
  width: 20vh;
  max-width: 240px;
  font-family: GameFont, sans-serif;
  z-index: 9;
  user-select: none;
}

#chat-toggle{
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 0.4vh 0.6vh;
  border: 0.3vh solid #fff;
  cursor: pointer;
  text-align: center;
  font-weight: bold;
  font-size: 2.4vh;
}

#chat-wrapper.disabled #chat-toggle {
  opacity: 0.5;
}

#chat-wrapper.unavailable #chat-toggle {
  animation: shake .35s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}

/* Updated chat-panel to always fit on screen */
#chat-panel {
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 1.2vh;
  top: 6vh;
  /* allow resizing but constrain to viewport so it never overflows */
  width: min(90vw, 720px);
  min-width: 220px;
  max-width: calc(100vw - 3.6vh);
  height: auto;
  max-height: calc(100vh - 12vh); /* leave room for top/bottom UI */
  resize: both;
  overflow: auto;
  padding: 0.6vh;
  box-sizing: border-box;
  background: rgba(0,0,0,0.92);
  border: 0.3vh solid #fff;
  margin-top: 0.4vh;
}

/* ensure inner sections size adapt to constrained panel */
#chat-header {
  display:flex;
  justify-content: space-between;
  align-items:center;
  color: #fff;
  margin-bottom: 0.4vh;
  flex: 0 0 auto;
}

#chat-title { font-weight: bold; font-size: 2.4vh; }
#chat-close { cursor: pointer; font-size: 2.4vh; }

#chat-messages {
  flex: 1 1 auto;
  background: rgba(255,255,255,0.02);
  padding: 1vh;
  overflow-y: auto;
  color: #fff;
  font-size: 2.4vh;
  line-height: 1.2;
  border: 0.1vh solid rgba(255,255,255,0.03);
  box-sizing: border-box;
  min-height: 5vh;
}

.chat-line { margin-bottom: 0.6vh; line-height: 1.1; }
.chat-line.me { opacity: 0.9; }
.chat-name { color: #ffd480; font-weight: bold; margin-right: 0.4vh; }
.chat-text { color: #fff; }

#chat-input-row { display:flex; gap:0.4vh; margin-top: 0.4vh; flex: 0 0 auto; }
#chat-input { flex:1; padding: 0.6vh; font-size:2.4vh; box-sizing: border-box; min-width: 60px; }
#chat-send { padding: 0.6vh 1vh; cursor: pointer; font-size: 2.4vh; }

/* Chat name modal (Omori style) */
#chat-name-modal {
  position: absolute;
  top: 2vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: 60vw;
  max-width: 420px;
  pointer-events: auto;
  user-select: none;
  font-family: GameFont, sans-serif;
}

#chat-name-box {
  background: rgba(0,0,0,0.95);
  border: 0.4vh solid #fff;
  outline: 0.12vh solid #000;
  padding: 1vh;
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
  align-items: center;
  box-sizing: border-box;
}

#chat-name-title {
  font-size: 3vh;
  color: #ffd480;
  font-weight: bold;
  text-align: center;
}

#chat-name-input {
  width: 90%;
  padding: 0.6vh;
  font-size: 3vh;
  background: #0a0a0a;
  color: #fff;
  border: 0.2vh solid rgba(255,255,255,0.12);
  outline: none;
  box-sizing: border-box;
}

#chat-name-buttons {
  display:flex;
  gap: 1vh;
  width: 90%;
  justify-content: center;
}

#chat-name-buttons button {
  padding: 0.6vh 1.2vh;
  background: #000;
  color: #fff;
  border: 0.4vh solid #fff;
  font-family: GameFont, sans-serif;
  cursor: pointer;
  font-size: 1.8vh;
}

/* small responsive adjustments */
@media (max-width: 420px) {
  #chat-panel { width: 86vw; height: 42vh; min-height: 32vh; }
  #chat-messages { font-size: 2.1vh; }
  #chat-input { font-size: 2.1vh; }
  #chat-send { font-size: 2.1vh; }
}

/* Active players box (bottom-right) */
#playerbox-wrapper {
  position: absolute;
  bottom: 1.2vh;
  right: 1.2vh;
  width: 16vh;
  max-width: 200px;
  background: rgba(0,0,0,0.85);
  border: 0.4vh solid #fff;
  outline: 0.12vh solid #000;
  padding: 0.4vh;
  z-index: 12;
  font-family: GameFont, sans-serif;
  color: #fff;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 0.4vh;
}

#playerbox-wrapper.disabled { opacity: 0.5; filter: grayscale(60%); }

#playerbox-title {
  font-weight: bold;
  font-size: 1.6vh;
  text-align: center;
  margin-bottom: 0.2vh;
}

#playerbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.4vh;
  max-height: 12vh;
  overflow-y: auto;
}

.player-entry {
  display: flex;
  align-items: center;
  gap: 0.4vh;
  font-size: 1.2vh;
}

.player-avatar {
  width: 2.4vh;
  height: 2.4vh;
  border-radius: 2px;
  object-fit: cover;
  background: #222;
  border: 0.08vh solid rgba(255,255,255,0.06);
}

.player-avatar.placeholder {
  display: inline-block;
  background: #444;
}

.player-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-empty {
  font-size: 1.1vh;
  color: #ddd;
  text-align: center;
}

/* small responsive tweak */
@media (max-width: 420px) {
  #playerbox-wrapper { width: 26vw; }
  .player-avatar { width: 3.2vh; height: 3.2vh; }
}

/* Mobile controls (bottom-middle) */
#mobile-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1.2vh;
  z-index: 50;
  width: 46vw;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  gap: 2vh;
  pointer-events: auto;
  user-select: none;
}

/* Collision patcher button (bottom-center) */
#collision-patcher {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 6.6vh; /* sits just above mobile controls */
  z-index: 55;
  font-family: GameFont, sans-serif;
  background: rgba(10,10,10,0.9);
  color: #fff;
  border: 0.35vh solid #fff;
  outline: 0.12vh solid #000;
  padding: 0.5vh 1vh;
  border-radius: 6px;
  font-size: 1.6vh;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

#collision-patcher:active { transform: translateX(-50%) scale(0.98); }

@media (min-width: 900px) {
  /* ensure buttons visible on desktop */
  #collision-patcher { display: block; }
  #door-patcher { display: block; }
  #reset-game-button { display: block; }
}

/* On small screens hide these utility buttons entirely to avoid overlap with mobile controls.
   Use !important so inline styles applied by JS won't unintentionally reveal them. */
@media (max-width: 900px) {
  #collision-patcher,
  #door-patcher,
  #reset-game-button {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* nudge TP test menu and other floating controls away from bottom mobile controls */
  #tp-test-menu {
    bottom: 14vh;
    top: auto;
    right: 1.2vh;
  }

  /* ensure mobile-controls remain centered on narrow viewports */
  #mobile-controls {
    left: 50%;
    transform: translateX(-50%);
    bottom: 1.6vh;
    width: 88vw;
    max-width: 420px;
  }
}

#dpad {
  width: 28vw;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  background: rgba(0,0,0,0.5);
  border: 0.35vh solid #fff;
  outline: 0.12vh solid #000;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 6%;
  box-sizing: border-box;
  align-items: center;
  justify-items: center;
}

.dpad-btn {
  width: 72%;
  height: 72%;
  background: rgba(255,255,255,0.06);
  border: 0.12vh solid rgba(255,255,255,0.12);
  border-radius: 8px;
  touch-action: none;
  display:flex;
  align-items:center;
  justify-content:center;
  color: #fff;
  font-weight: bold;
  font-family: GameFont, sans-serif;
  font-size: 2.2vh;
}

.dpad-btn:active {
  transform: scale(0.96);
}

#dpad .center {
  background: transparent;
  border: none;
  pointer-events: none;
}

#btn-z {
  width: 80px;
  height: 80px;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  background: rgba(200,40,40,0.92);
  border: 0.35vh solid #fff;
  outline: 0.12vh solid #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: GameFont, sans-serif;
  font-size: 20px;
  touch-action: none;
  /* explicitly prevent CSS transforms applied by container from affecting this element */
  transform: none !important;
  will-change: auto;
}

@media (min-width: 900px) {
  /* hide mobile controls on large screens */
  #mobile-controls { display: none; }
}

/* Chat temporary dialogue board (bottom-center) */
#chat-dialogue-box {
  /* legacy fixed style removed in favor of description-style box */
  display: none;
}

/* New: render chat dialogue using same look/animations as .discription */
.chat-dialogue-description {
  background-color: #000000;
  position: absolute;
  bottom: 3%;
  left: 50%;
  transform: translateX(-50%);
  width: 125%;
  max-width: 1100px;
  height: 0%;
  overflow: hidden;
  outline: solid #FFFFFF;
  border: solid black 3px;
  justify-content: space-between;
  animation: open 0.1s linear forwards;
  z-index: 40;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  pointer-events: none;

  /* ensure scaled container (game) affects this element predictably */
  transform-origin: top left;
}

.chat-dialogue-description.closing {
  animation: close 0.12s linear forwards;
}

.chat-dialogue-description #chat-dialogue-text {
  font-family: GameFont, sans-serif;
  font-size: 33px;
  padding-left: 15px;
  color: #FFFFFF;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  animation:
    typing 0.9s steps(40),
    cursor .4s step-end infinite alternate;
}

/* reuse pointer style similar to #pointer */
.chat-dialogue-description #chat-dialogue-pointer {
  position: absolute;
  bottom: 0;
  right: 30px;
  width: 40px;
  height: 20px;
  animation: movePointer 1s ease-in-out infinite;
}

/* ensure small screens scale down text a bit */
@media (max-width: 420px) {
  .chat-dialogue-description #chat-dialogue-text { font-size: 18px; }
}

.chat-dialogue-description #chat-dialogue-pointer {
  position: absolute;
  bottom: 0;
  right: 30px;
  width: 40px;
  height: 20px;
  animation: movePointer 1s ease-in-out infinite;
}

/* ensure small screens scale down text a bit */
@media (max-width: 420px) {
  .chat-dialogue-description #chat-dialogue-text { font-size: 18px; }
}

/* small entry/exit animations */
@keyframes chatDialogIn {
  0% { transform: translateX(-50%) translateY(8px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@keyframes chatDialogOut {
  0% { transform: translateX(-50%) translateY(0); opacity: 1; }
  100% { transform: translateX(-50%) translateY(8px); opacity: 0; }
}

/* ensure pointer also stays crisp when scaled */
.chat-dialogue-description #chat-dialogue-pointer img,
#pointer {
  image-rendering: pixelated;
}

#tile-history-box{
  position: absolute;
  left: 2.5vh;
  top: 40%;
  transform: translateY(-50%);
  z-index: 70;
  background: rgba(0,0,0,0.8);
  border: 0.12vh solid rgba(255,255,255,0.12);
  color: #fff;
  font-family: GameFont, sans-serif;
  font-size: 1.2vh;
  padding: 0.6vh;
  width: 9.5vh;
  box-sizing: border-box;
  pointer-events: none;
  box-shadow: none;
}

/* When entering the Whitespace map, expand the game container so the canvas is not visually clipped by its box */
body.whitespace-open .game-container {
  overflow: visible !important;
  width: auto !important;
  height: auto !important;
  transform: none !important; /* allow full map to be visible; engine still uses camera math */
}

/* Ensure the canvas itself can render beyond the original container boundaries */
body.whitespace-open .game-container .game-canvas {
  max-width: none !important;
  max-height: none !important;
  overflow: visible !important;
  image-rendering: pixelated;
}