html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  overflow: hidden;
}

@font-face {
  font-family: 布丁体;
  src: url("project/fonts/hkbdt.ttf") format("truetype");
}

@font-face {
  font-family: hkbdt;
  src: url("project/fonts/hkbdt.ttf") format("truetype");
}

@font-face {
  font-family: uiFont;
  src: url("project/fonts/ubuntu.ttf") format("truetype");
}

@font-face {
  font-family: ChaoZiSheZengYuBoShouShuJianFan;
  src: url("project/fonts/ChaoZiSheZengYuBoShouShuJianFan.ttf")
    format("truetype");
}

@font-face {
  font-family: DFPZongYiW9-P;
  src: url("project/fonts/DFPZongYiW9-P.ttf") format("truetype");
}

@font-face {
  font-family: WenDingGuangGaoTi;
  src: url("project/fonts/WenDingGuangGaoTi.ttf") format("truetype");
}

@font-face {
  font-family: WenDingNiuNiuTi;
  src: url("project/fonts/WenDingNiuNiuTi.ttf") format("truetype");
}

#gameGroup {
  position: absolute;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  background-color: #000;
}

#mainTips {
  color: #fff;
  font-size: 0.8em;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 370;
}

#musicBtn {
  position: fixed;
  bottom: 3px;
  right: 3px;
  cursor: pointer;
  z-index: 400;
  display: none;
}

#enlargeBtn {
  position: fixed;
  bottom: 3px;
  right: 34px;
  cursor: pointer;
  z-index: 400;
  display: none;
}

#startPanel {
  width: 100%;
  height: 100%;
  position: relative !important;
  top: 0;
  left: 0;
  background-color: #fff;
  overflow: hidden;
  z-index: 300;
  box-sizing: border-box !important;
}

#startTop {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: #000;
  z-index: 350;
}

#startTopProgressBar {
  width: 90%;
  height: 5%;
  margin: 0 5%;
  position: absolute;
  top: 5%;
  background-color: #fff;
  z-index: 15;
}

#startTopProgress {
  width: 0%;
  height: 100%;
  background-color: #666;
}

#startTopLoadTips {
  color: #fff;
  font-size: 0.6em;
  position: absolute;
  top: 10%;
  left: 5%;
  z-index: 15;
}

#startTopHint {
  color: #66ccff;
  position: absolute;
  bottom: 0;
  left: 5%;
  z-index: 15;
  font-size: 1.1em;
}

#startBackground {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100%;
  width: 100%; /* 改为100%，配合cover铺满容器 */
  transform: translate(-50%, -50%);
  z-index: 260;
  /* 核心新增：cover 适配 + 优化显示 */
  object-fit: cover; /* 铺满容器，裁剪边缘，保留比例 */
  object-position: center; /* 裁剪时优先保留图片中心内容（关键） */
  /* 兼容旧浏览器 + 避免空白 */
  min-width: 100%;
  min-height: 100%;
  /* 最邻近算法缩放 */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

#startLogo {
  position: absolute;
  z-index: 290;
  left: 0;
  margin-top: 0;
  max-width: 100%;
  text-align: left;
  font: 6em ChaoZiSheZengYuBoShouShuJianFan;
}

#startTitle {
  position: absolute;
  z-index: 280;
}

#startButtonGroup {
  width: auto;
  position: absolute;
  text-align: center;
  font-size: 1.4em;
  display: block;
  z-index: 310;
  bottom: 0;
  margin-bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 25px 25px; /* 增加内边距，给溢出的伪元素留空间 */
  min-width: 20%;
  opacity: 0.85;
  color: #ffffff;
  caret-color: #ffd700;
  border-radius: 0px;
  overflow: visible !important; /* 确保外层不截断溢出内容 */
}

#startButtons {
  display: grid; /* Grid布局 */
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 10px;
  min-width: 300px;
  max-width: 500px;
  margin: 0 auto;
  overflow: visible !important;
  position: relative;
  z-index: 1;
}

/* 按钮基础样式 */
#playGame,
#loadGame,
#replayGame,
#gameIntroduce,
#aboutEnemys {
  position: relative;
  margin: 0;
  padding: 6px 0;
  width: 100%;
  text-align: center;
  font:
    900 1.3em "WenDingGuangGaoTi",
    "STHeiti",
    "SimHei",
    sans-serif;
  color: #ffffff;
  background-image: url("project/materials/ground.png");
  background-size: auto;
  background-repeat: repeat;
  background-position: center;
  border: 2px solid #808080;
  border-radius: 0px;
  overflow: visible;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: all 0.3s ease;
  z-index: 2;
  margin: 5px 0;
}

#playGame:hover::before {
  content: "";
  position: absolute;
  /* 宽度减少外扩，高度适度外扩，避免左右显示过多 */
  width: calc(100% + 8px); /* 宽度外扩从16px减到8px */
  height: calc(100% + 16px);
  top: -8px;
  left: -4px; /* 水平偏移对应宽度外扩的一半 */
  transform: translateZ(0);
  background-image: url("project/images/startCursorLarge.png");
  /* 使用contain适配，避免背景图拉伸导致左右过多 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1;
  z-index: 10;
  border-radius: 0px;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* 为其他四个按钮设置伪元素样式（单列，宽度窄） */
#loadGame:hover::before,
#replayGame:hover::before,
#gameIntroduce:hover::before,
#aboutEnemys:hover::before {
  content: "";
  position: absolute;
  /* 宽度减少外扩，高度适度外扩，避免左右显示过多 */
  width: calc(100% + 8px); /* 宽度外扩从16px减到8px */
  height: calc(100% + 16px);
  top: -8px;
  left: -4px; /* 水平偏移对应宽度外扩的一半 */
  transform: translateZ(0);
  background-image: url("project/images/startCursorSmall.png");
  /* 使用contain适配，避免背景图拉伸导致左右过多 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 1;
  z-index: 10;
  border-radius: 0px;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* 按钮网格位置 */
#playGame {
  grid-column: 1 / 3;
  grid-row: 1;
}
#loadGame {
  grid-column: 1;
  grid-row: 2;
}
#replayGame {
  grid-column: 2;
  grid-row: 2;
}
#gameIntroduce {
  grid-column: 1;
  grid-row: 3;
}
#aboutEnemys {
  grid-column: 2;
  grid-row: 3;
}

/* 隐藏不需要的元素 */
#startButtons {
  display: block; /* 保持显示，让按钮在容器内 */
}

#levelChooseButtons {
  display: none;
}

#floorMsgGroup {
  top: 3px;
  right: 3px;
  position: absolute;
  text-align: center;
  display: none;
  color: #fff;
  background-color: #000;
  z-index: 230;
}

#logoLabel {
  margin-top: 8%;
  font: bold 3em STXingkai;
  margin-left: auto;
  margin-right: auto;
}

#versionLabel {
  margin-top: -3%;
  font-size: 1.2em;
  font-weight: bold;
}

#floorNameLabel {
  margin-top: 30px;
  font-size: 1.6em;
  font-weight: bold;
}

#statusBar {
  position: absolute;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  background: url(project/materials/ground.png) repeat;
  z-index: 185;
  display: none;
  top: 0;
  left: 0;
  padding: 3px;
}
#statusBar .status {
  position: relative;
  display: block;
  float: left;
  width: 100%;
}
.status img {
  vertical-align: middle;
  width: auto;
  height: 100%;
  max-height: 1.6em;
}
#statusBar span {
  font: bold italic 1.1em Verdana;
  display: inline;
}
#statusBar p {
  display: inline-block;
  vertical-align: middle;
  width: 60%;
  margin: 0;
  color: white;
  font: bold italic 1.1em Verdana;
  white-space: nowrap;
}
#toolBar {
  position: absolute;
  background: url(project/materials/ground.png) repeat;
  z-index: 210;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  display: none;
  padding: 3px;
}
#toolBar .tools {
  position: relative;
  display: block;
  float: left;
}

p#hard {
  width: 6em;
  vertical-align: middle;
  display: inline-block;
  color: red;
  font: bold normal 1.1em "Arial Black";
  text-align: center;
  margin: 0 6px 6px 0;
  word-break: keep-all;
}

span#poison,
span#weak,
span#curse,
span#pickaxe,
span#bomb,
span#fly {
  font-style: normal;
  font-size: 1em;
}

p#name {
  font-style: normal;
}

.gameCanvas {
  position: absolute;
  box-sizing: border-box;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

#gif {
  z-index: 20;
  position: absolute;
  overflow: hidden;
}

#gif2 {
  z-index: 90;
  position: absolute;
  overflow: hidden;
}

#gameDraw {
  position: absolute;
  background: #000000;
  overflow: hidden;
  z-index: 185;
}

#bg {
  z-index: 10;
}

#event {
  z-index: 30;
}

#hero {
  z-index: 40;
}

#event2 {
  z-index: 50;
}

#fg {
  z-index: 60;
}

#damage {
  z-index: 65;
}

#animate {
  z-index: 70;
}

#curtain {
  z-index: 125;
}

#ui {
  z-index: 140;
}

#data {
  z-index: 170;
}

#inputDiv {
  display: none;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(127, 127, 127, 0.6);
  z-index: 2000;
}

#inputDialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  background: white;
  width: 250px;
  min-height: 50px;
}

#inputMessage {
  word-wrap: break-word;
  text-align: left;
  margin-left: 8%;
  margin-right: 5%;
}

#inputBox {
  margin-left: 8%;
  width: 80%;
  margin-bottom: 10px;
  padding: 5px 3px;
  border: 1px solid;
  background: #f0f0f0;
}

#inputYes {
  margin-bottom: 15px;
  margin-left: 8%;
}

#inputNo {
  float: right;
  margin-right: 10%;
}

#_selector,
._uievent_selector {
  animation: selector 2s ease-in-out 0s infinite normal none running;
}

@-webkit-keyframes selector {
  0% {
    opacity: 0.95;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 0.95;
  }
}

@keyframes selector {
  0% {
    opacity: 0.95;
  }
  50% {
    opacity: 0.55;
  }
  100% {
    opacity: 0.95;
  }
}

#next {
  width: 5px;
  height: 5px;
  display: none;
  position: absolute;
  transform: rotate(45deg);
  border-bottom-width: 4px;
  border-bottom-style: solid;
  border-right-width: 4px;
  border-right-style: solid;
  -webkit-animation: next 0.5s ease-in-out alternate infinite;
  animation: next 0.5s ease-in-out alternate infinite;
  left: 0;
  top: 0;
  opacity: 0.7;
  z-index: 169;
}

@-webkit-keyframes next {
  100% {
    transform: rotate(45deg) translate(-3px, -3px);
  }
}
@keyframes next {
  100% {
    transform: rotate(45deg) translate(-3px, -3px);
  }
}

#startImageBackgroundDiv {
  display: none;
  width: 100%;
  height: 100%;
  position: fixed;
  z-index: 10000;
}

#startImageDiv {
  width: 100%;
  height: 100%;
  position: fixed;
  background: black;
  opacity: 1;
}

#startImageLogo {
  opacity: 0;
  max-width: 60%;
  max-height: 60%;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.startImageAnimation {
  -webkit-animation: startImage 4s ease-in-out 1s alternate 1;
  animation: startImage 4s ease-in-out 1s alternate 1;
}

@-webkit-keyframes startImage {
  0% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes startImage {
  0% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.startImageDivAnimation {
  -webkit-animation: startImageDivDisappear 2s ease-in-out 5s alternate 1;
  animation: startImageDivDisappear 2s ease-in-out 5s alternate 1;
}

@-webkit-keyframes startImageDivDisappear {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes startImageDivDisappear {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.anti-aliasing {
  image-rendering: pixelated;
}
