/* ============================================================
 * hud.css —— 游戏 HUD、舞台、四层画布、缩放控件、适配面板
 * 全项目不使用毛玻璃（backdrop-filter），一律用不透明或半透明纯色背景。
 * ============================================================ */

#screen-game {
  position: relative; /* 适配面板相对它绝对定位，浮在舞台上而不挤压舞台 */
  gap: 10px;
  padding-bottom: 4px;
}

/* ---------------- 顶部 HUD ---------------- */

.hud-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #14161d;
}

.hud-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 56px;
}

.hud-label { font-size: 10.5px; color: var(--dim); letter-spacing: 0.06em; }

.hud-value {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud-progress { flex: 1 1 180px; min-width: 140px; }

.hud-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 5px;
}

.progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.16s ease-out;
}

/* ---------------- 缩放控件 ---------------- */

.zoom-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.zoom-value { min-width: 48px; text-align: center; font-size: 14px; }

.btn.tiny {
  font-size: 12px;
  padding: 4px 9px;
  min-height: 30px;
  line-height: 1.1;
}

/* ---------------- 舞台 ---------------- */

#stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  /* 放大后舞台会超出容器，这里允许滚动查看。
     用 overflow:auto 而不是 hidden —— 用户明确要求"图片可以放大"，
     放大之后必须能看到整张图，而不是被裁掉。 */
  overflow: auto;
  overscroll-behavior: contain;
}

/* margin:auto 而不是 justify-content:center：后者在内容大于容器时会把
   顶部/左侧裁掉且滚不到，margin:auto 则能正常居中 + 正常滚动。 */
#stage {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  overflow: hidden;
  background: var(--stage-bg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  /* touch-action:none 是移动端必填项：否则手指拖动会被浏览器当成滚动/缩放吃掉 */
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}

/* 按住左键时换成"抓紧"光标，让"正在刮"这件事有反馈 */
#stage.is-pressing { cursor: grabbing; }

#stage canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
}

/* ---------------- 引导 / 提示 ---------------- */

#guide {
  position: absolute;
  inset: auto 0 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  font-size: 13.5px;
}

.guide-hand {
  font-size: 40px;
  animation: press-hint 1.6s ease-in-out infinite;
}

/* 提示"按住 + 拖动"，所以是按下的小幅缩放，而不是左右滑动 */
@keyframes press-hint {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.55; }
  45% { transform: translateY(6px) scale(0.9); opacity: 1; }
}

#toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  background: #12141a;
  border: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ---------------- 底部工具栏 ---------------- */

.hud-bottom {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* "全部刮开"之后把下一关按钮点亮，引导用户去点它 */
.btn.is-callout {
  animation: callout 1.1s ease-in-out infinite;
}

@keyframes callout {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 107, 139, 0.28); }
  50% { box-shadow: 0 8px 30px rgba(255, 214, 120, 0.75); }
}

/* ---------------- 笔触大小 ---------------- */

.brush-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.brush-group input[type="range"] {
  width: 92px;
  accent-color: var(--accent);
  height: 24px;
}

/* "实际大小"预览：一个实心圆，直径就是笔触在屏幕上的直径 */
.brush-preview {
  display: inline-block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 107, 139, 0.28);
  border: 1.5px solid var(--accent);
  transition: width 0.12s ease-out, height 0.12s ease-out;
}

@media (max-width: 720px) {
  .hud-top { gap: 10px; padding: 8px 10px; }
  .hud-cell { min-width: 48px; }
  .hud-value { font-size: 13.5px; }
  .brush-group input[type="range"] { width: 68px; }
}
