/* 逃离猪肉丸 · 最终版（M4 打磨）样式
   在 M3（提交框 / 排行榜按钮 / 榜单弹层）基础上打磨：
   提交失败提示变红（.submit-msg.err），红与结束界面标题的粉红同族，
   成功仍是金豆色——整页配色只有金豆金 / 猪肉丸粉 / 草地绿三族。
   只用系统自带字体，不引用任何外部资源。 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #2b3a2f;            /* 深绿背景，突出中间的游戏画面 */
  color: #333;
  min-height: 100vh;
}

/* 三块界面（开始 / 游戏 / 结束）都铺满屏幕居中显示，
   JS 通过加上 hidden 这个类来切换显示哪一块。 */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.hidden {
  display: none;
}

h1 {
  font-size: 56px;
  color: #ffd54f;                 /* 标题用金豆的颜色 */
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  margin-bottom: 24px;
}

#screen-over h1 {
  color: #f48fb1;                 /* 结束界面标题用猪肉丸的粉色 */
}

.story {
  font-size: 20px;
  line-height: 1.9;
  color: #eee;
  margin-bottom: 20px;
}

.help {
  font-size: 16px;
  line-height: 1.8;
  color: #b8ccb8;
  margin-bottom: 32px;
}

.score-line {
  font-size: 26px;
  color: #eee;
  margin-bottom: 32px;
}

#final-score {
  font-size: 40px;
  font-weight: bold;
  color: #ffd54f;
}

.big-btn {
  font-size: 24px;
  padding: 14px 48px;
  border: none;
  border-radius: 999px;
  background: #ffd54f;
  color: #5d4037;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 0 #c8a415;
}

.big-btn:hover {
  background: #ffe082;
}

.big-btn:active {
  transform: translateY(3px);     /* 按下去的感觉 */
  box-shadow: 0 2px 0 #c8a415;
}

.big-btn:disabled {               /* 提交中/已提交时按钮变灰、按不动 */
  background: #bdbdbd;
  color: #757575;
  box-shadow: 0 3px 0 #8d8d8d;
  cursor: default;
}

/* —— M3 新增：开始界面的排行榜按钮（和开始按钮上下排，中间隔开一点） —— */
.board-btn {
  margin-top: 14px;
  font-size: 18px;
  padding: 10px 36px;
}

/* —— M3 新增：结束界面的"名字输入框 + 提交成绩"一排 —— */
.submit-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.name-input {
  font-size: 20px;
  padding: 10px 16px;
  border: 2px solid #8bc34a;
  border-radius: 999px;
  outline: none;
  width: 220px;
  font-family: inherit;
}

.name-input:focus {
  border-color: #ffd54f;          /* 输入时边框变金色，提示当前在这里打字 */
}

.submit-btn {
  font-size: 18px;
  padding: 10px 28px;
}

.submit-msg {
  min-height: 26px;               /* 成功/失败提示占一行，防止字一出来按钮跳位置 */
  font-size: 15px;
  color: #ffd54f;
  margin-bottom: 10px;
}

/* —— M4 新增：提交失败的提示加 .err 变红（成功保持金豆色） —— */
.submit-msg.err {
  color: #ef9a9a;
}

/* —— M3 新增：排行榜弹层（半透明黑底盖住整屏，中间一块浅色榜单） —— */
.board-layer {
  position: fixed;                /* 盖在窗口上，和当前是哪个界面无关 */
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* —— M4 修复：弹层"关闭"必须真的藏起来 ——
   .hidden 和 .board-layer 都是单个类选择器（权重相同），这时写在样式表后面的规则赢：
   .board-layer 的 display:flex 排在 .hidden 的 display:none 之后，把"隐藏"压掉了，
   结果弹层关了也还盖在屏幕上（真实鼠标连"开始游戏"都点不到）。
   这里用"两个类叠加"的更高权重选择器，把关闭状态钉死为不显示。 */
.board-layer.hidden {
  display: none;
}

.board-box {
  background: #fffde7;
  border-radius: 14px;
  padding: 28px 36px;
  min-width: 320px;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.board-box h1 {
  font-size: 32px;
  color: #5d4037;
  text-shadow: none;
  margin-bottom: 18px;
}

.board-list {
  text-align: left;
  font-size: 18px;
  line-height: 2;
  color: #333;
  margin-bottom: 20px;
  list-style-position: inside;
}

/* 画布：小屏幕上自动缩小，保持 800:500 的比例 */
canvas {
  width: min(96vw, 800px);
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
