@font-face {
  font-family: 'LiberationSansBold';
  src: url('fonts/LiberationSans-Bold.ttf') format('truetype');
}

@font-face {
  font-family: 'LiberationSansRegular';
  src: url('fonts/LiberationSans-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'LoraItalic';
  src: url('fonts/Lora-Italic-VariableFont_wght.ttf') format('truetype');
}

@font-face {
  font-family: 'Lora';
  src: url('fonts/Lora-VariableFont_wght.ttf') format('truetype');
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "LiberationSansBold", sans-serif;
  background: linear-gradient(135deg, #150D10 0%, #140D14 100%);
  color: white;
  min-height: 100vh;
  overflow: hidden; /* Prevent scrolling on mobile */
  touch-action: manipulation; /* Improve touch performance */
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none; /* Disable iOS callout */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100vw;
  margin: 0;
  padding: 0;
}

#phaser-game {
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 100vw;
  max-height: 100vh;
}

canvas {
  display: block;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  justify-content: center;
}

/* Tablet landscape */
@media screen and (max-width: 1023px) and (min-width: 768px) and (orientation: landscape) {
  body {
    overflow: hidden;
  }
}

/* Mobile landscape - primary target */
@media screen and (max-width: 767px) and (orientation: landscape) {
  body {
    overflow: hidden;
    background-attachment: fixed; /* Prevent background issues on mobile */
  }

  #game-container {
    width: 100vw;
  }

  #phaser-game {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 👈 force content to top */
    background: black; /* or match game bg */
  }

  canvas {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0;
    max-width: 100%;
    max-height: 100%;
  }

}

/* Mobile portrait - discourage but handle gracefully */
@media screen and (max-width: 767px) and (orientation: portrait) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #150D10 0%, #140D14 100%);
  }

  #game-container {
    display: none;
  }

  body::before {
    content: "Please rotate your device to landscape mode for the best experience";
    display: block;
    text-align: center;
    font-size: 18px;
    color: white;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    margin: 20px;
  }
}

/* Very small screens */
@media screen and (max-width: 480px) and (orientation: landscape) {
  #game-container {
    padding: 0;
  }
}

/* High DPI displays */
@media screen and (-webkit-min-device-pixel-ratio: 2), screen and (min-resolution: 192dpi) {
  canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
  #game-container {
    height: 100vh;
  }
}

/* Prevent zoom on double tap */
@media screen and (max-width: 767px) {
  * {
    touch-action: manipulation;
  }
}
