* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
body {
  min-height: 100vh;
  background: linear-gradient(to bottom, #7ec8f7 0%, #a5d8f3 34%, #9be3b8 62%, #7fd49b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 10px 14px;
  overflow-x: hidden;
}
h1 {
  font-size: 21px;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 255, 255, 0.35);
}
/* 顶部信息栏：三个元素等宽并排，高度一致 */
.info-panel {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  align-items: stretch;
}
.info-box {
  flex: 1 1 0;
  min-width: 0;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  padding: 7px 6px;
  text-align: center;
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.info-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 1px;
  margin-bottom: 2px;
}
.info-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}
.info-value.high { color: #ffd54f; }
#pauseBtn {
  flex: 1 1 0;
  min-width: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  padding: 7px 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
#pauseBtn:active { transform: scale(0.96); filter: brightness(0.92); }
/* 关卡目标 + 进度条 + 步数 */
.target-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.target-row span {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.target-row #timeVal { background: rgba(255, 159, 67, 0.35); }
.target-row #timeVal.low { background: rgba(239, 83, 80, 0.55); }
.progress-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.progress-track {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd54f, #ff9f43);
  border-radius: 8px;
  transition: width 0.25s ease;
}
.steps-box {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 4px 10px;
  white-space: nowrap;
}
/* 连击狂热条：连续消除积攒倍率 */
.fever-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.fever-label {
  font-size: 12px;
  font-weight: 900;
  color: #ffd54f;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.fever-track {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.fever-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #69f0ae, #ffd54f, #ff7043);
  border-radius: 8px;
  transition: width 0.2s ease;
}
.fever-fill.hot { animation: feverGlow 0.6s ease-in-out infinite alternate; }
@keyframes feverGlow { from { filter: brightness(1); } to { filter: brightness(1.55); } }
/* 道具栏 */
.toolbar {
  width: 100%;
  max-width: 420px;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.tool-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, filter 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tool-btn svg { flex-shrink: 0; display: block; }
/* count / AD badge on each booster button */
.tool-count { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-width: 24px; font-size: 15px; font-weight: 900; }
.tool-count .ad-under { z-index: 0; }
.tool-count .ad-overlay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.4); /* translucent chip next to the visible 0 */
  color: #1b2838;
  border-radius: 6px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  z-index: 1;
}
.tool-btn.ad-needed .tool-count .ad-overlay svg { color: #1b2838; }
/* 道具用尽：显示 AD 徽标，点击可看广告补充 */
.tool-btn.ad-needed {
  background: linear-gradient(135deg, #ffd54f, #ff9f43);
  color: #1b2838;
  border-color: rgba(255, 213, 79, 0.9);
  box-shadow: 0 3px 12px rgba(255, 159, 67, 0.55);
}
.tool-btn.ad-needed svg { color: #1b2838; }
.tool-btn:active { transform: scale(0.95); filter: brightness(0.9); }
.tool-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.tool-btn.active { background: rgba(255, 159, 67, 0.85); border-color: #fff; }
#gameWrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.65);
  background: #fdf6e3;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fdf6e3;
}
#loaderScreen {
  position: absolute;
  inset: 0;
  background: #a5d8f3;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}
.loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.loader-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ff9f43;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  animation: blink 1.2s ease-in-out infinite;
}
.loader-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 1px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
#overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 40, 30, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 12px;
  gap: 7px;
  overflow-y: auto;
  /* safe vertical centering: flexbox scroll-safe pattern */
  justify-content: flex-start;
}
#overlay > :first-child { margin-top: auto; }
#overlay > :last-child { margin-bottom: auto; }
#overlay > * { flex-shrink: 0; } /* 禁止压缩子元素，避免面板/按钮被压扁、文字截断 */
#overlay h2 {
  font-size: 26px;
  color: #ffd54f;
  text-shadow: 0 0 14px rgba(255, 213, 79, 0.5);
}
#overlay p {
  font-size: 13px;
  color: #e8f5e9;
  line-height: 1.5;
}
.diff-row { display: flex; gap: 8px; width: 100%; max-width: 320px; margin-bottom: 8px; }
.btn-row { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; width: 100%; max-width: 320px; }
.btn-row-row { display: flex; gap: 8px; width: 100%; max-width: 320px; }
.btn-row-row-2 { display: flex; gap: 8px; width: 100%; max-width: 320px; }
button {
  border: none;
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button:active { transform: scale(0.96); filter: brightness(0.92); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
.btn-primary { background: linear-gradient(135deg, #4fc3f7, #0288d1); box-shadow: 0 8px 20px rgba(2, 136, 209, 0.45); }
.btn-success { background: linear-gradient(135deg, #66bb6a, #2e7d32); box-shadow: 0 8px 20px rgba(46, 125, 50, 0.45); }
.btn-danger { background: linear-gradient(135deg, #ef5350, #c62828); box-shadow: 0 8px 20px rgba(198, 40, 40, 0.45); }
.btn-secondary { background: linear-gradient(135deg, #90a4ae, #607d8b); }
.diff-btn { padding: 9px; font-size: 13px; }
/* 两个绿色广告按钮：缩小并居中 */
#extraStepsBtn, #unlockAllAchBtn {
  padding: 7px 12px;
  font-size: 13px;
  max-width: 240px;
  margin: 0 auto;
  border-radius: 10px;
}
.hidden { display: none !important; }
.hint {
  margin-top: 8px;
  font-size: 13px;
  color: #1b4d2e;
  text-align: center;
  line-height: 1.4;
  font-weight: 600;
}
.privacy-text {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(27, 77, 46, 0.8);
  text-align: center;
}
.privacy-text a { color: #1565c0; text-decoration: underline; }
.achievement-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(46, 125, 50, 0.95);
  color: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 20;
  max-width: 90%;
  text-align: center;
}
.ach-list, .about-panel {
  width: 100%;
  max-width: 320px;
  text-align: left;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  max-height: 240px;
  overflow-y: auto;
  flex-shrink: 0;
}
.ach-item { padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.18); font-size: 13px; color: #fff; line-height: 1.5; }
.about-panel p { line-height: 1.65; }
.locked { color: rgba(255, 255, 255, 0.72); }
.unlocked { color: #ffd54f; }
/* 登录 / 注册面板（可选账号） */
.auth-status { font-size: 12px; color: #ffd54f; margin-bottom: 4px; font-weight: 700; letter-spacing: 0.5px; }
.auth-panel {
  width: 100%;
  max-width: 320px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 10px;
}
.auth-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 13px;
}
.auth-input::placeholder { color: rgba(255, 255, 255, 0.55); }
.auth-btns { display: flex; gap: 8px; }
.auth-btns button { flex: 1; padding: 8px; font-size: 13px; }
.auth-msg { font-size: 12px; min-height: 16px; margin-top: 6px; color: #ffcc80; }
/* 关卡进度续玩提示 */
.progress-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #ffd54f;
  margin: 2px 0 4px;
}
.progress-reset {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.progress-reset:hover { border-color: #ffd54f; color: #ffd54f; }
