@font-face {
  font-family: 'dafont';
  src: url('../assets/font/dafont.ttf') format('truetype');
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'dafont', 'Arial Black', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

#app {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#stage-wrap {
  position: absolute;
  inset: 0;
}
#game {
  width: 100%;
  height: 100%;
  display: block;
}

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#ver {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font: bold 14px monospace;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
  z-index: 20;
}

/* ---- buttons: 黑底 + 彩色描边，与原版 SimpleGUI.Button 一致 ---- */
#ui .btn {
  pointer-events: auto;
  cursor: pointer;
  text-align: center;
  color: #fff;
  background: #000;
  border: 0.7vh solid var(--sp-color, #0ff);
  box-sizing: border-box;
  padding: 1.2vh 0;
  font-size: 4.5vh;
  letter-spacing: 0.05em;
  line-height: 1;
}
#ui .btn:active {
  filter: brightness(1.5);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.55);
}
.hidden { display: none !important; }

/* ---- MENU: 与原版 OnGUI 比例一致（标题 24% / HighScore 43% / Play 62% 高度） ---- */
#menu .title {
  font-size: 9vh;
  color: var(--sp-color, #0ff);
  text-shadow: 0.4vh 0.4vh 0 #000;
  pointer-events: auto;
  width: 100%;
  text-align: center;
  padding: 3vh 0;
  box-sizing: border-box;
}
#menu .btn {
  width: 78%;
  margin: 2.5vh auto;
}

/* ---- DIFFICULTY ---- */
#diff-name {
  font-size: 10vh;
  color: var(--sp-color, #0ff);
  text-shadow: 0.4vh 0.4vh 0 #000;
  margin-bottom: 2vh;
}
#diff-hint {
  font-size: 3.2vh;
  color: rgba(255,255,255,0.6);
  margin-top: 3vh;
  letter-spacing: 0.1em;
}
#difficulty .row {
  display: flex;
  justify-content: space-around;
  width: 85%;
  margin-top: 3vh;
}
#difficulty .row .btn { width: 40%; }
#difficulty .diff-back {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 13%;
  border-left: none;
  font-size: 3.5vh;
}
#difficulty .diff-back { border-bottom: none; }

/* ---- HIGHSCORE ---- */
.hs-title {
  font-size: 7vh;
  color: var(--sp-color, #0ff);
  text-shadow: 0.4vh 0.4vh 0 #000;
  margin-bottom: 3vh;
}
#hs-list {
  font-size: 4.5vh;
  color: #fff;
  text-shadow: 0.2vh 0.2vh 0 #000;
  margin-bottom: 4vh;
  text-align: center;
  line-height: 1.9;
}
#highscore .diff-back {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 13%;
  border-left: none;
  border-bottom: none;
  font-size: 3.5vh;
}

/* ---- GAME HUD: 计时器（黑底 + 上边框彩色，右对齐，MM:SS:CC） ---- */
#hud-top {
  position: absolute;
  top: 0;
  right: 0;
  pointer-events: none;
}
#hud-time {
  font-size: 5vh;
  color: var(--sp-color, #0ff);
  background: #000;
  border-top: 0.7vh solid var(--sp-color, #0ff);
  padding: 1vh 1.2vh 1vh 2.5vh;
  letter-spacing: 0.05em;
}

/* ---- DEATH: 面板从左侧滑入（deathOffset 动画）+ 上下彩色边框 ---- */
#death {
  justify-content: flex-start;
  padding-top: 10vh;
}
#death-box {
  width: 100%;
  border-top: 0.8vh solid var(--sp-color, #0ff);
  border-bottom: 0.8vh solid var(--sp-color, #0ff);
  background: #000;
  padding: 3vh 0 3vh 7%;
  box-sizing: border-box;
  text-align: left;
}
#death-best, #death-new {
  font-size: 5vh;
  color: #fff;
  text-shadow: 0.2vh 0.2vh 0 #000;
  padding-left: 0;
}
#death-new.new-high {
  font-size: 5.5vh;
  color: var(--sp-color, #0ff);
  text-decoration: underline;
}
#death-retry {
  font-size: 3.2vh;
  color: #ccc;
  margin-top: 2.5vh;
  text-shadow: 0.2vh 0.2vh 0 #000;
}
#death .diff-back {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50%;
  height: 13%;
  border-left: none;
  border-bottom: none;
  font-size: 3.5vh;
}
#death .diff-rate {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 50%;
  height: 13%;
  border-right: none;
  border-bottom: none;
  font-size: 3.5vh;
}

/* 竖屏时自动旋转为横屏（仅触摸设备，由 JS 添加 portrait-fix 类） */
body.portrait-fix #app {
  top: 50%;
  left: 50%;
  width: 100vh;
  height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
}

/* ---- 安装门槛（手机浏览器未添加为应用时显示） ---- */
#install-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #100e1a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vw;
  box-sizing: border-box;
  font-family: 'dafont', 'Arial Black', sans-serif;
}
#install-gate.hidden { display: none; }
.gate-box {
  width: 100%;
  max-width: 640px;
  text-align: center;
  color: #fff;
}
.gate-title {
  font-size: 12vw;
  color: #0ff;
  text-shadow: 0.5vw 0.5vw 0 #000;
  margin-bottom: 5vw;
}
.gate-msg {
  font-size: 5.5vw;
  line-height: 1.7;
  margin-bottom: 6vw;
}
.gate-steps {
  text-align: left;
  background: rgba(255, 255, 255, 0.06);
  border: 0.4vw solid rgba(0, 255, 244, 0.5);
  border-radius: 2vw;
  padding: 4vw 5vw;
  font-size: 4.2vw;
  line-height: 2;
  margin-bottom: 6vw;
}
.gate-steps b { color: #0ff; }
.gate-btn {
  width: 70%;
  margin: 0 auto;
  font-size: 6vw;
  color: #000;
  background: #0ff;
  border: 0.8vw solid #0ff;
  padding: 3vw 0;
  border-radius: 1vw;
  cursor: pointer;
}
.gate-note {
  font-size: 3.6vw;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4vw;
  line-height: 1.6;
}
