/*body {*/
/*  display: flex;*/
/*  flex-direction: column;*/
/*  justify-content: space-between; !* 在上下方向上均匀分配空间 *!*/
/*  align-items: center; !* 水平居中对齐 *!*/
/*  height: 100vh; !* 使页面高度占满视口 *!*/
/*  margin: 0; !* 去掉默认的边距 *!*/
/*}*/

#display-container {
  align-items: center; /* 水平居中对齐 */
  height:100%;
}

#display {
  display: flex;
  flex-direction: column;
  align-items: center; /* 水平居中对齐 */
  flex-grow: 1; /* 让display占据剩余空间 */
  height:100%;
}

#canvas {
  /*border: 1px solid #66666666; !* 可选：为canvas添加边框 *!*/
  display: block; /* 确保canvas以块级元素显示 */
  margin: 0px; /* 上下留一些空间 */
  transform: scale(1.0);
  aspect-ratio: 240/320;
  height: 100%;
}

@media (max-width: 768px) {
  .j2me_game_container_v3 {
    flex-direction: column;
  }

  .display-container_full{
    height: 60%!important;
  }

  .display-container_full2{
    height: 50%!important;
  }
}

#keypad {
  text-align: center;
  font-size: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@media (max-width: 768px) {
  #keypad {
    margin-top: 10px;
  }

  .gamepad-1 {
    min-width : 90%!important;
  }
}

@media (min-width: 768px) {
  #keypad {
    margin-left: 30px;
  }
}

.gamepad-0 { display: none; }
.gamepad-1 { display: block; min-width: 230px; min-height: 200px; }
.gamepad-2 { display: block; min-width: 320px; min-height: 320px; }
.gamepad-3 { display: block; min-width: 480px; min-height: 480px; }
.gamepad-4 { display: block; min-width: 640px; min-height: 640px; }

#keypad.column,
#keypad.column2,
#keypad.row,
#keypad.row-reverse,
#keypad.joypad,
#keypad.numpad,
#keypad.numpad2 {
  display: flex;
  flex-direction: column;
}

#keypad.row>div,
#keypad.row-reverse>div {
  flex: 1;
}

#keypad.row {
  flex-direction: row;
}

#keypad.row-reverse {
  flex-direction: row-reverse;
}

#keypad.joypad>#numpad {
  display: none;
}

#keypad.numpad>#joypad,
#keypad.numpad2>#joypad {
  display: none;
}

.key {
  font-size: 20px;
  cursor: pointer;
  margin: 2px;
  height: 45px;
  line-height: 40px;
  width: calc(33.33% - 8px);
  border: none;
  background: linear-gradient(145deg, #222, #333);
  color: white;
  text-align: center;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  font-weight: 600;
}

.key:hover {
  background: linear-gradient(145deg, #2a2a2a, #3a3a3a);
}

.key:active {
  transition-duration: 0.05s; /* 按下时使用更短的过渡时间 */
  box-shadow: inset 2px 2px 5px rgba(0,0,0,0.5),
  inset -2px -2px 5px rgba(80,80,80,0.5);
  transform: translateY(2px);
  background: #111;
}

@media (hover: none) and (pointer: coarse) {
  .key {
    transition: none; /* 移动端可以完全移除过渡 */
  }

  .key:active {
    transform: translateY(2px) scale(0.98); /* 更简单的按下效果 */
    box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
    transition: none;
  }
}

#keypad.column2>#numpad>.key,
#keypad.numpad2>#numpad>.key {
  width: 24%;
  width: calc(25% - 8px);
}

.key.numpad2 {
  display: none;
}

#keypad.column2>#numpad>.key.numpad,
#keypad.numpad2>#numpad>.key.numpad {
  display: none;
}

#keypad.column2>#numpad>.key.numpad2,
#keypad.numpad2>#numpad>.key.numpad2 {
  display: inline-block;
}

.arrow {
  color: #4d9de0;
  font-size: 16px;
  margin-left: 4px;
}

/* Press effect */
.key::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity 0.2s;
}

.key:active::after {
  opacity: 1;
}

/* Special keys styling */
/*#ok {*/
/*  background: linear-gradient(145deg, #1a5a8a, #0d3b66);*/
/*  color: white;*/
/*}*/

/*#ok:hover {*/
/*  background: linear-gradient(145deg, #164b73, #0a3255);*/
/*}*/

/*#star, #pound {*/
/*  color: #ccc;*/
/*}*/

/*#choice, #back {*/
/*  background: linear-gradient(145deg, #333, #222);*/
/*  font-weight: bold;*/
/*}*/

/* 可选：添加其他样式以增强视觉效果 */
.title {
  font-size: 24px;
  margin: 10px 0;
}

.screen {
  display: none; /* 默认隐藏所有屏幕 */
}

#download-screen, #splash-screen, #exit-screen {
  display: flex; /* 让这些屏幕元素为flex布局 */
  flex-direction: column;
  align-items: center; /* 水平居中对齐 */
  justify-content: center; /* 垂直居中对齐 */
  height: 100%; /* 高度占满父元素 */
}
