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

html, body {
  height: 100%;
  overflow: hidden;
  background: #1b2735;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#wrap {
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

/* UI 层按 1200x600 的逻辑尺寸排版，再整体缩放 */
#ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 1200px;
  height: 600px;
  transform-origin: 0 0;
  pointer-events: none;
}

#hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

#levelLabel {
  font-size: 26px;
  font-weight: 800;
}

#bestLabel {
  font-size: 16px;
  opacity: 0.9;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#score {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1px;
}

.hud-buttons {
  display: flex;
  gap: 8px;
}

#hud button {
  pointer-events: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #ff7043;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #bf360c;
}

#hud button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #bf360c;
}

#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

#overlay.show {
  display: flex;
}

.panel {
  min-width: 420px;
  max-width: 560px;
  padding: 28px 36px;
  text-align: center;
  background: linear-gradient(#fff8e1, #ffe0b2);
  border: 5px solid #8d5524;
  border-radius: 22px;
  box-shadow: 0 8px 0 #5d3a1a, 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.panel h1 {
  font-size: 40px;
  color: #d84315;
  text-shadow: 0 3px 0 #ffcc80;
  margin-bottom: 8px;
}

#ovStars {
  font-size: 54px;
  letter-spacing: 6px;
  color: #ffc107;
  text-shadow: 0 3px 0 #b8860b;
}

#ovStars .off {
  color: #bdbdbd;
  text-shadow: 0 3px 0 #8d8d8d;
}

#ovText {
  font-size: 18px;
  line-height: 1.7;
  color: #5d4037;
  margin: 10px 0 18px;
  white-space: pre-line;
}

#ovButtons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

#ovButtons .row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#ovButtons button {
  min-width: 150px;
  padding: 10px 22px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: #8bc34a;
  border: 3px solid #fff;
  border-radius: 14px;
  box-shadow: 0 4px 0 #558b2f;
  cursor: pointer;
  font-family: inherit;
}

#ovButtons button.secondary {
  background: #ff9800;
  box-shadow: 0 4px 0 #e65100;
}

#ovButtons button.level {
  min-width: 340px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

#ovButtons button.level small {
  font-size: 15px;
  opacity: 0.9;
  align-self: center;
}

#ovButtons button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #558b2f;
}
