/* General elements */

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: black;
  color: #fafafa;
  overflow: hidden;
}

section {
  clear: both;
}

a {
  color: white;
  font-weight: bold;
  text-decoration: none;
}


/* General animations */

.hoverable {
  opacity: .84;
  -moz-transition: 140ms opacity;
  -o-transition: 140ms opacity;
  -webkit-transition: 140ms opacity;
  transition: 140ms opacity;
}

  .hoverable:hover {
    opacity: 1;
  }

/* Game section */

section#game {
  min-height: 464px;
}

  section#game .EightBitter {
    margin: auto;
  }



/* Control section */

#controls {
  text-align: center;
}

  #controls .control {
    position: relative;
    display: inline-block;
    margin-top: 0;
    height: 35px;
    width: 256px;
    border: 3px solid black;
    border-radius: 7px;
    box-shadow: 0 3px 7px black inset;
    background: black;
    font-family: 'Press Start', 'PingFang SC', 'Heiti SC', sans-serif;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    overflow: hidden;
    -moz-transition: 70ms all;
    -o-transition: 70ms all;
    -webkit-transition: 70ms all;
    transition: 70ms all;
  }

  #controls.length-4 .control {
    min-width: 25%;
  }

  #controls.length-5 .control {
    min-width: 20%;
  }

  #controls .control:hover {
    margin-top: -322px;
    height: 350px; /* 322px + 28px */
    border-color: #99ffcc;
    background: #009966;
    z-index: 70;
  }

  #controls .control h4 {
    position: absolute;
    right: 0;
    bottom: 7px;
    left: 0;
    margin: 0;
  }

  #controls .control-inner {
    margin-top: 28px;
    padding: 7px 3px;
    opacity: 0;
    -moz-transition: 35ms opacity;
    -o-transition: 35ms opacity;
    -webkit-transition: 35ms opacity;
    transition: 35ms opacity;
  }

  #controls .control:hover .control-inner {
    display: block;
    margin-top: 0;
    opacity: 1;
  }

  #controls .select-options {
    position: relative;
    max-height: 308px; /* 322 - 14*/
    overflow-x: hidden;
    overflow-y: auto;
  }

  #controls .select-option-title {
    padding: 7px;
  }

  #controls .select-option {
    margin: 1px 3px;
    display: inline-block;
    background: #ffcc33;
    border: 3px outset;
    cursor: pointer;
    color: black;
    font-size: 14px;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }

    #controls .select-option.option-enabled {
      background: #ffcc33;
    }

    #controls .select-option.option-disabled {
      background: #ccaa33;
    }

    #controls .select-option.select-option-inset {
      border: 3px inset;
    }

    #controls .select-option.select-option-large {
      padding: 14px 0;
      font-size: 15px;
      line-height: 140%;
    }

  #controls .disabled {
    opacity: .49 !important;
    cursor: default !important;
    -ms-user-select: none !important;
    -moz-user-select: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
  }


  /* Controls - option buttons */

  #controls .options-button-option {
    position: relative;
    display: block;
    left: 0;
    right: 0;
    padding: 4px 0;
    /* width: 70px; */
  }

  #controls input[type=number] {
    display: inline;
    margin-left: -3px;
    padding-left: 17px;
    /* font-size: 1em; */
    font-family: "Press Start", 'PingFang SC', 'Heiti SC', sans-serif;
  }

  #controls select {
    /* font-size: 1em; */
    font-family: "Press Start", 'PingFang SC', 'Heiti SC', sans-serif;
  }


  /* Controls - options */

  #controls #control-Options .select-options td {
    padding-top: 7px;
    padding-bottom: 7px;
  }


  /* Controls - option keys */

  #controls .options-label-Keys {
    padding-left: 14px;
  }

  #controls .options-cell-Keys {
    padding: 7px 0;
  }

  #controls .options-key-option {
    display: block;
  }

    #controls .options-key-option:not(:last-of-type):after {
      content: ", ";
    }


  /* Controls - tables */

  #controls table {
    width: 100%;
    border-spacing: 1px;
    padding: 0 2px;
  }

    #controls table input {
      max-width: 70px;
    }

  #controls .maps-grid-option {
    display: table-cell;
    padding: 3px;
  }

  #controls .maps-grid-option-extra {
    display: block;
    margin: 7px 2px 3px 1px;
    padding: 14px 3px;
  }

  #controls .maps-grid-input {
    margin: 0 2px 0 1px;
    width: 98%;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    font-family: 'Press Start', 'PingFang SC', 'Heiti SC', sans-serif;
    text-align: center;
  }


  /* Controls - uploader */

  #controls .select-upload {
    cursor: pointer;
    overflow: hidden;
  }

  #controls .select-upload-input {
    display: none;
  }


  /* Controls - built-in maps */

  #controls .select-options-editor-maps-holder {
    width: 100%;
  }
/* F-10 手机自适应（2026-10-19 站长令：要横屏、铺满全屏、自适应）——以下规则只作用于触屏设备，桌面不受影响 */
#rotate-prompt {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  background: #202a30;
  color: #faf9f6;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  font-family: 'Press Start', 'PingFang SC', 'Heiti SC', sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
#rotate-prompt .phone-icon {
  width: 44px;
  height: 78px;
  border: 4px solid #faf9f6;
  border-radius: 8px;
  animation: ao-rotate 1.8s ease-in-out infinite;
}
@keyframes ao-rotate {
  0%, 20% { transform: rotate(0deg); }
  55%, 90% { transform: rotate(90deg); }
  100% { transform: rotate(90deg); }
}
/* 竖屏：全屏提示横屏（挡住不可玩的竖屏画面）；顺手锁滚动防画布盒溢出 */
@media (orientation: portrait) and (pointer: coarse) and (max-width: 820px) {
  #rotate-prompt { display: flex; }
  html, body { overflow: hidden; }
}
/* 横屏：铺满全屏——藏桌面菜单区（触屏控件在游戏容器内不受影响） */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 820px) {
  html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
  }
  #controls { display: none; }
}

/* 全端铺满（2026-10-19 三版）：画布盒用 vmax/vmin（=视口长边/短边，与画布内部尺寸同一套 max/min 算法）——
   谎报转屏尺寸的浏览器里 vw/vh 盒子仍是竖形，横屏画面塞进去只剩中间一条且上下大黑边；vmax/vmin 盒子恒横屏形状 */
html, body { margin: 0; background: #000; }
#game canvas {
  width: 100vmax;
  height: 100vmin;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
}
/* 触屏：内部 2× 超采样后等比缩回，用平滑插值（pixelated 最近邻在缩小时会丢行出锯齿） */
@media (pointer: coarse) {
  #game canvas { image-rendering: auto; }
}

/* 触屏控件层从四边向内抬：躲开 iOS 底部地址胶囊/全面屏手势条与刘海（inline 样式需 !important 压过）；
   fixed+独立层级钉死视口，不随任何祖先容器的定位/裁剪翻车 */
.touch-passer-container {
  position: fixed !important;
  z-index: 9998;
  top: calc(env(safe-area-inset-top, 0px) + 6px) !important;
  right: calc(env(safe-area-inset-right, 0px) + 6px) !important;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 54px) !important;
  left: calc(env(safe-area-inset-left, 0px) + 6px) !important;
}

/* 十版B 手机菜单抽屉：横屏满屏时 #controls 被隐藏，「菜单」钮开 body.ao-menu-open 从底部升起；
   打开时收起虚拟按键（游戏已自动暂停），抽屉半透明深色、可滚动、不挡顶部 HUD。
   菜单原型是桌面横排 256px 小盒+hover 展开（还 margin-top:-322px 上浮），抽屉态全部推翻：
   竖排满宽、常开展开、去上浮。（ao-menu-open 只会由触屏设备的菜单钮打上，无需媒体门） */
body.ao-menu-open #controls {
  display: block !important;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 62dvh;
  overflow-y: auto;
  background: rgba(10, 14, 16, .92);
  z-index: 9997;
  padding: 10px 12px 26px;
}
body.ao-menu-open .touch-passer-container {
  display: none !important;
}
body.ao-menu-open #controls .control,
body.ao-menu-open #controls .control:hover {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  margin: 8px 0 !important;
  overflow: visible !important;
  background: rgba(0, 0, 0, .55);
  border-color: rgba(250, 249, 246, .35);
}
body.ao-menu-open #controls .control h4 {
  position: static !important;
  padding: 8px 4px 4px;
}
body.ao-menu-open #controls .control-inner {
  display: block !important;
  opacity: 1 !important;
  margin-top: 0 !important;
}
body.ao-menu-open #controls .select-options {
  max-height: none !important;
}
