* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #2a4d3a 0%, #101d14 70%);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#app { display: flex; justify-content: center; padding: 4px; }

#game-wrap {
  position: relative;
  width: 1120px;
  height: 680px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  touch-action: none; /* 禁止手势缩放/滚动干扰游戏操作 */
  --gs: 1; /* 游戏缩放系数，由 JS fitScreen 注入，覆盖层据此同步缩放 */
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #7ec850;
  touch-action: none;
}

/* 竖屏小屏幕时提示横屏游玩 */
#rotate-hint {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 50;
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(0, 0, 0, .72);
  color: #ffd94d;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
}
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-hint { display: block; }
}

/* 小屏适配已由 --gs 缩放系数统一处理，无需额外媒体查询 */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 12, .78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.overlay.hidden { display: none; }

.overlay-box {
  text-align: center;
  background: linear-gradient(160deg, #3b2a15, #241808);
  border: calc(4px * var(--gs)) solid #8a6a2f;
  border-radius: calc(18px * var(--gs));
  padding: calc(40px * var(--gs)) calc(60px * var(--gs));
  box-shadow: 0 calc(12px * var(--gs)) calc(40px * var(--gs)) rgba(0, 0, 0, .5);
  max-width: 96%;
  max-height: 96%;
  overflow: auto;
}

.title {
  font-size: calc(44px * var(--gs));
  color: #ffd94d;
  text-shadow: 0 calc(3px * var(--gs)) 0 #7a5200, 0 calc(6px * var(--gs)) calc(12px * var(--gs)) rgba(0,0,0,.5);
  letter-spacing: calc(2px * var(--gs));
}

.subtitle {
  margin-top: calc(12px * var(--gs));
  font-size: calc(18px * var(--gs));
  color: #cde7b0;
}

.tips {
  margin: calc(24px * var(--gs)) 0;
  text-align: left;
  color: #e8f5d8;
  font-size: calc(15px * var(--gs));
  line-height: 2;
}

.big-btn {
  margin-top: calc(8px * var(--gs));
  padding: calc(14px * var(--gs)) calc(56px * var(--gs));
  font-size: calc(22px * var(--gs));
  font-weight: bold;
  color: #fff;
  background: linear-gradient(180deg, #7ac74f, #4a9030);
  border: calc(3px * var(--gs)) solid #2f6b1c;
  border-radius: calc(40px * var(--gs));
  cursor: pointer;
  letter-spacing: calc(4px * var(--gs));
  text-shadow: 0 calc(2px * var(--gs)) calc(2px * var(--gs)) rgba(0,0,0,.4);
  transition: transform .1s;
}
.big-btn:hover { transform: scale(1.06); filter: brightness(1.1); }
.big-btn:active { transform: scale(.97); }

/* 结算按钮行 */
.btn-row { margin-top: calc(16px * var(--gs)); display: flex; gap: calc(12px * var(--gs)); justify-content: center; flex-wrap: wrap; }
.btn-row .big-btn { padding: calc(12px * var(--gs)) calc(26px * var(--gs)); font-size: calc(18px * var(--gs)); letter-spacing: calc(2px * var(--gs)); }

/* 关卡选择 */
.level-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(14px * var(--gs));
  margin: calc(26px * var(--gs)) auto calc(20px * var(--gs));
  max-width: calc(560px * var(--gs));
}
.level-btn {
  padding: calc(14px * var(--gs)) calc(8px * var(--gs));
  border-radius: calc(12px * var(--gs));
  border: calc(3px * var(--gs)) solid #8a6a2f;
  background: linear-gradient(180deg, #5c4526, #3b2a15);
  cursor: pointer;
  transition: transform .1s, filter .1s;
}
.level-btn:hover:not(.locked) { transform: scale(1.05); filter: brightness(1.2); }
.level-btn.locked { opacity: .5; cursor: not-allowed; }
.lv-num { display: block; font-size: calc(18px * var(--gs)); font-weight: bold; color: #ffd94d; }
.lv-name { display: block; font-size: calc(14px * var(--gs)); color: #e8f5d8; margin-top: calc(4px * var(--gs)); }
.lv-sub { display: block; font-size: calc(12px * var(--gs)); color: #9fb98a; margin-top: calc(3px * var(--gs)); }
