* {
  box-sizing: border-box;
}

/* 全局禁止文字选中 — 针对所有移动端浏览器 */
html, body, div, span, canvas, button, p, h1, strong, a {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  align-items: center;
  background: #f4f6f1;
  color: #18201c;
  display: flex;
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  justify-content: center;
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.page-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 960px;
  min-height: 100dvh;
}

/* ── 游戏标题（游戏界面上方）── */
.game-title {
  padding: 6px 16px 10px;
  text-align: center;
  width: 100%;
}

.game-title strong {
  display: block;
  font-size: 52px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 3px;
}

.game-shell {
  background: #fffdf6;
  border: 2px solid #28342d;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(32, 42, 35, 0.16);
  overflow: hidden;
  position: relative;
  touch-action: none;
  width: 100%;
  flex-shrink: 0;
}

.hud {
  align-items: center;
  background: #ffffff;
  border-bottom: 2px solid #28342d;
  display: flex;
  justify-content: flex-end;
  min-height: 40px;
  padding: 6px 16px;
}

.scoreboard {
  color: #1b2f25;
  display: flex;
  flex-wrap: wrap;
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  gap: 14px;
  justify-content: flex-end;
  min-width: 170px;
  text-align: right;
}

canvas {
  aspect-ratio: 8 / 3;
  background: #f7fbff;
  display: block;
  height: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  width: 100%;
}

.overlay {
  align-items: center;
  background: rgba(255, 253, 246, 0.88);
  display: flex;
  flex-direction: column;
  inset: 40px 0 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  font-size: clamp(30px, 7vw, 64px);
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 12px;
}

.overlay p {
  color: #4d554d;
  font-size: clamp(14px, 2.5vw, 18px);
  line-height: 1.6;
  margin: 0 0 18px;
  max-width: 520px;
}

button {
  background: #1f6f4a;
  border: 2px solid #163826;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: 700 18px/1 Arial, "Microsoft YaHei", sans-serif;
  min-height: 44px;
  min-width: 112px;
  padding: 0 22px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button:active {
  transform: translateY(1px);
}

/* ── 手机端控制按钮 ── */
.mobile-controls {
  display: none;
}

/* ── 手机端操作提示（按钮下方）── */
.game-hint {
  display: none;
}

@media (max-width: 560px) {
  body {
    padding: 0;
    align-items: center;
  }

  .page-shell {
    max-width: 100%;
    min-height: auto;
    justify-content: center;
  }

  .game-title {
    padding: 4px 12px 8px;
  }

  .game-title strong {
    font-size: 32px;
  }

  .game-shell {
    max-width: calc(100vw - 24px);
    display: block;
  }

  .hud {
    min-height: 34px;
    padding: 5px 10px;
  }

  .scoreboard {
    font-size: 14px;
    gap: 6px;
    min-width: auto;
  }

  .overlay {
    inset: 34px 0 0;
  }

  /* 触控按钮栏 */
  .mobile-controls {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 10px 0 18px;
    gap: 12px;
    width: calc(100vw - 24px);
    max-width: 960px;
  }

  .control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    padding: 14px 0;
    font-size: 16px;
    font-weight: 700;
    width: 100%;
    max-width: 180px;
    min-height: 56px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.06s, box-shadow 0.06s;
    -webkit-tap-highlight-color: transparent;
  }

  .control-button:active {
    transform: scale(0.95);
  }

  .jump-button {
    background: linear-gradient(135deg, #1f6f4a, #2a8f5e);
    color: #fff;
    box-shadow: 0 4px 14px rgba(31, 111, 74, 0.35);
  }

  .jump-button:active {
    box-shadow: 0 1px 4px rgba(31, 111, 74, 0.35);
  }

  .duck-button {
    background: linear-gradient(135deg, #4a5568, #64748b);
    color: #fff;
    box-shadow: 0 4px 14px rgba(74, 85, 104, 0.3);
  }

  .duck-button:active {
    box-shadow: 0 1px 4px rgba(74, 85, 104, 0.3);
  }

  /* 操作提示 */
  .game-hint {
    display: block;
    text-align: center;
    padding: 8px 16px 14px;
    width: calc(100vw - 24px);
    max-width: 960px;
  }

  .game-hint p {
    margin: 0;
    color: #5e665d;
    font-size: 12px;
    line-height: 1.6;
  }
}
