.ghost {
  margin: 0;
  position: absolute;
  z-index: 2;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

@keyframes ghostBob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
.ghost.bobbing {
  animation: ghostBob 0.5s ease-in-out infinite;
}

@keyframes scaredBlueAnimation {
  0% {
    transform: translateY(0) scaleX(1);
  }
  25% {
    transform: translateY(-4px) scaleX(1);
  }
  50% {
    transform: translateY(0) scaleX(-1);
  }
  75% {
    transform: translateY(-4px) scaleX(-1);
  }
  100% {
    transform: translateY(0) scaleX(1);
  }
}
.ghost.scared-blue-animated {
  animation: scaredBlueAnimation 0.6s ease-in-out infinite;
  transform-origin: center;
}

@keyframes scaredWhiteAnimation {
  0% {
    transform: translateY(0) scaleX(1);
  }
  25% {
    transform: translateY(-4px) scaleX(1);
  }
  50% {
    transform: translateY(0) scaleX(-1);
  }
  75% {
    transform: translateY(-4px) scaleX(-1);
  }
  100% {
    transform: translateY(0) scaleX(1);
  }
}
.ghost.scared-white-animated {
  animation: scaredWhiteAnimation 0.6s ease-in-out infinite;
  transform-origin: center;
}
* {
  font-family: "Press Start 2P", sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overflow-mask {
  background: #000;
  color: #fff;
  display: flex;
  height: 100vh;
  height: 100dvh;
  justify-content: center;
  align-items: center;
  margin: 0;
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
  width: 100vw;
  width: 100dvw;
  min-width: 0;
  min-height: 0;
}

.game-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  font-size: clamp(8px, calc(32px * 100vw / 896), 32px);
  max-width: 100vw;
  max-height: 100vh;
  width: 100%;
}
@media (orientation: portrait) {
  .game-wrapper {
    max-height: calc(100vh - 11em);
  }
}

.backdrop {
  position: absolute;
  visibility: hidden;
}

.fps-display {
  position: absolute;
  right: 10px;
  top: 10px;
  visibility: hidden;
}

.preload-div {
  align-items: baseline;
  bottom: 0;
  display: flex;
  flex-wrap: wrap-reverse;
  position: absolute;
  visibility: hidden;
}

.header-buttons {
  display: flex;
  gap: 0.25em;
  align-items: center;
  margin-left: auto;
  z-index: 2;
}
.header-buttons button {
  background: rgba(255, 198, 14, 0.1);
  border: 0.0625em solid #FFC60E;
  border-radius: 0.25em;
  color: #FFC60E;
  cursor: pointer;
  outline: none;
  padding: 0.25em;
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.header-buttons button:hover {
  background: rgba(255, 198, 14, 0.2);
  box-shadow: 0 0 0.46875em rgba(255, 198, 14, 0.4);
}
.header-buttons button .material-icons {
  font-size: 0.75em;
  width: 0.75em;
  height: 0.75em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paused-text {
  align-items: center;
  color: #FFC60E;
  display: flex;
  font-size: 50px;
  height: 100%;
  justify-content: center;
  left: 0;
  position: absolute;
  text-shadow: 0 0 20px rgba(255, 198, 14, 0.8);
  user-select: none;
  visibility: hidden;
  width: 100%;
  z-index: 1;
}

.game-ui {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  font-size: 1em;
  aspect-ratio: 896/1152;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
}
@media (orientation: portrait) {
  .game-ui {
    max-height: calc(100vh - 11em);
    width: min(100%, calc((100vh - 11em) * (896 / 1152)));
  }
}
@media (orientation: landscape) {
  .game-ui {
    width: min(100vw, calc(100vh * (896 / 1152)));
    max-height: 100vh;
  }
}
.game-ui .one-up {
  animation: blink 0.6s infinite;
}
@keyframes blink {
  0% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}
.game-ui .row {
  display: flex;
  min-width: 0;
  width: 100%;
}
.game-ui .top {
  align-items: center;
  justify-content: space-between;
  flex: 0 0 calc(3 / 36 * 100%);
  min-height: calc(3 / 36 * 100%);
}
.game-ui .top ._25 {
  width: 25%;
  min-width: 0;
  flex-shrink: 0;
}
.game-ui .top ._50 {
  width: 50%;
  min-width: 0;
  flex-shrink: 0;
}
.game-ui .top .column :first-child {
  text-align: center;
}
.game-ui .top .column :not(:first-child) {
  margin-right: calc(50% - 3em);
  text-align: right;
}
.game-ui .bottom {
  justify-content: space-between;
  min-width: 0;
  flex: 0 0 calc(2 / 36 * 100%);
  min-height: calc(2 / 36 * 100%);
}
.game-ui .bottom .extra-lives {
  align-items: flex-start;
  display: flex;
  min-width: 0;
}
.game-ui .bottom .fruit-display {
  display: flex;
  flex-direction: row-reverse;
  min-width: 0;
}

@media (orientation: landscape) {
  .game-ui {
    height: 100%;
    max-height: 100vh;
  }
}
@media (orientation: portrait) {
  .game-ui {
    height: 66%;
    max-height: 66vh;
  }
}
.loading-cover {
  background: linear-gradient(135deg, #845E00 0%, #FFC60E 100%);
  height: 100vh;
  position: absolute;
  top: 0;
  width: 50vw;
  z-index: 4;
}

.left {
  left: 0;
  transition: left 0.5s 0.5s;
}

.right {
  right: 0;
  transition: right 0.5s 0.5s;
}

.main-menu-container {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  left: 0;
  opacity: 0;
  position: absolute;
  transition: opacity 0.25s;
  visibility: hidden;
  width: 100%;
  z-index: 5;
}

.logo {
  height: 150px;
  margin-top: 20vh;
  max-width: 90%;
  width: auto;
  filter: drop-shadow(0 0 20px rgba(255, 198, 14, 0.5));
}
@media (max-width: 768px) {
  .logo {
    height: auto;
    max-height: 25vh;
    margin-top: 10vh;
    width: 85%;
  }
}

.game-start {
  background: linear-gradient(135deg, #FFC60E 0%, #845E00 100%);
  border: 3px solid #FFC60E;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(255, 198, 14, 0.4), 0 8px 16px rgba(0, 0, 0, 0.5);
  color: #0a0a0a;
  cursor: pointer;
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 2px;
  outline: none;
  padding: 20px 40px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}
@media (max-width: 768px) {
  .game-start {
    font-size: 24px;
    padding: 16px 32px;
    letter-spacing: 1px;
    margin-top: 4vh;
  }
}
.game-start:hover {
  background: linear-gradient(135deg, #FFD84A 0%, #FFC60E 100%);
  box-shadow: 0 0 30px rgba(255, 198, 14, 0.6), 0 12px 24px rgba(0, 0, 0, 0.6);
  transform: translateY(-2px);
}
.game-start:active {
  box-shadow: 0 0 15px rgba(255, 198, 14, 0.4), 0 4px 8px rgba(0, 0, 0, 0.5);
  transform: translateY(0);
}
.game-start:disabled {
  cursor: default;
  opacity: 0.6;
}

.loading-container {
  background-color: #111111;
  border: 0.09375em solid #FFC60E;
  border-radius: 0.375em;
  box-shadow: 0 0 0.625em rgba(255, 198, 14, 0.4);
  font-size: clamp(12px, calc(32px * 100vw / 896), 32px);
  height: 1.5em;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  transition: opacity 0.5s 1s;
  width: min(15.625em, 90vw);
  z-index: 5;
}

.loading-pacman {
  animation: loading-bob 0.5s ease-in-out infinite;
  background-color: transparent;
  background-image: url("../app/style/graphics/matrix-logo-in-circle.svg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  filter: drop-shadow(0 0 0.25em rgba(255, 198, 14, 0.6));
  height: 1.5em;
  position: absolute;
  transition: left 1s;
  width: 1.5em;
  z-index: 6;
}

@keyframes loading-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}
.loading-dot-mask {
  background-color: #111111;
  border-radius: 0.3125em;
  height: 1.5em;
  left: 0;
  position: absolute;
  top: 0;
  transition: width 1s;
  z-index: -1;
}

.loading-dot {
  background-image: url("../app/style/graphics/spriteSheets/pickups/pacdot.svg");
  filter: drop-shadow(0 0 0.125em rgba(255, 198, 14, 0.8));
  height: 0.1875em;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0.1875em;
  z-index: -2;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

._5 {
  left: 5%;
}

._10 {
  left: 10%;
}

._15 {
  left: 15%;
}

._20 {
  left: 20%;
}

._25 {
  left: 25%;
}

._30 {
  left: 30%;
}

._35 {
  left: 35%;
}

._40 {
  left: 40%;
}

._45 {
  left: 45%;
}

._50 {
  left: 50%;
}

._55 {
  left: 55%;
}

._60 {
  left: 60%;
}

._65 {
  left: 65%;
}

._70 {
  left: 70%;
}

._75 {
  left: 75%;
}

._80 {
  left: 80%;
}

._85 {
  left: 85%;
}

._90 {
  left: 90%;
}

._95 {
  left: 95%;
}

.movement-buttons {
  align-items: flex-end;
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  justify-content: space-between;
  margin-top: auto;
  padding: 0.5em;
  width: 100%;
  box-sizing: border-box;
  gap: 1em;
  position: relative;
  z-index: 10;
}
.movement-buttons .thumb-control {
  display: flex;
  gap: 0.25em;
}
.movement-buttons .thumb-control.left-thumb {
  flex-direction: column;
  align-items: center;
}
.movement-buttons .thumb-control.right-thumb {
  flex-direction: row;
  align-items: center;
}
.movement-buttons button {
  background: rgba(255, 198, 14, 0.1);
  border: 0.09375em solid #FFC60E;
  border-radius: 0.25em;
  color: #FFC60E;
  height: 4.5em;
  outline: none;
  padding: 0;
  transition: all 0.2s ease;
  user-select: none;
  width: 4.5em;
  touch-action: manipulation;
  position: relative;
  z-index: 11;
  pointer-events: auto;
}
.movement-buttons button:hover {
  background: rgba(255, 198, 14, 0.2);
  box-shadow: 0 0 0.46875em rgba(255, 198, 14, 0.4);
}
.movement-buttons button:active {
  background: rgba(255, 198, 14, 0.3);
  box-shadow: 0 0 0.3125em rgba(255, 198, 14, 0.6);
  transform: scale(0.95);
}
.movement-buttons .material-icons {
  font-size: 2.625em;
  margin: 0;
}

@media (orientation: landscape) {
  .movement-buttons {
    display: none;
  }

  .game-wrapper {
    max-height: 100vh;
    width: min(100vw, calc(100vh * (896 / 1152)));
  }
}
.error-message {
  background: rgba(10, 10, 10, 0.95);
  border: 3px solid #FFC60E;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(255, 198, 14, 0.4);
  color: #FFC60E;
  opacity: 0;
  padding: 30px;
  position: absolute;
  top: 30vh;
  transition: opacity 0.5s;
  visibility: hidden;
  width: 50vw;
  z-index: 4;
}
.error-message .error-pacman {
  animation: error-animation 1.5s steps(12) infinite;
  background-image: url("../app/style/graphics/spriteSheets/characters/pacman/pacman_error.png");
  background-size: 576px;
  height: 48px;
  margin-left: 10px;
  width: 48px;
  z-index: 6;
}
@keyframes error-animation {
  100% {
    background-position: -576px;
  }
}
.error-message .header {
  display: flex;
  font-size: 50px;
  margin-bottom: 30px;
}
.error-message .body {
  font-size: 20px;
  line-height: 1.25;
}
.maze-cover {
  background: #000000;
  height: 100%;
  position: absolute;
  visibility: hidden;
  width: 100%;
  z-index: 3;
}

.maze {
  margin: 0 auto;
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  pointer-events: none;
}
.maze .pacman,
.maze .ghost,
.maze .dot-container > * {
  pointer-events: auto;
}

.maze-img {
  position: absolute;
  user-select: none;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.maze-row {
  display: flex;
}

.dot-container {
  height: 100%;
  position: absolute;
  width: 100%;
}
.pacman {
  margin: 0;
  position: absolute;
  z-index: 1;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
.power-pellet {
  animation: blink 0.3s infinite;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

@keyframes blink {
  0% {
    opacity: 0;
  }
  49% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}