:root {
  --brand: #FF8A3D;
  --brand-deep: #E86A1C;
  --brand-soft: #FFE3CC;
  --ink: #2A1B10;
  --ink-2: #6B5646;
  --ink-3: #A08C7B;
  --bg: #FFF4EA;
  --card: #FFFFFF;
  --line: rgba(255, 138, 61, 0.22);
  --shadow: 0 10px 24px rgba(232, 106, 28, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 0%, #FFD9B8 0%, rgba(255, 217, 184, 0) 62%),
    linear-gradient(180deg, #FFF1E2 0%, #FFE7D2 46%, #FFDCC0 100%);
}

/* ---------- 背景成品图 ---------- */
.bg-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.55;
}

.bg-mask {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 244, 234, 0.35) 0%, rgba(255, 231, 210, 0.55) 55%, rgba(255, 220, 192, 0.78) 100%),
    radial-gradient(120% 60% at 50% 100%, rgba(255, 138, 61, 0.18) 0%, rgba(255, 138, 61, 0) 70%);
}

#board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  z-index: 3;
}

.hud-left { display: flex; flex-direction: column; gap: 8px; }
.hud-right { display: flex; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  background: linear-gradient(180deg, #FFA45C 0%, var(--brand) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 14px rgba(232, 106, 28, 0.32);
  font-variant-numeric: tabular-nums;
}

.pill .mp-icon { width: 19px; height: 19px; opacity: 0.95; }

.pill-ghost {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(232, 106, 28, 0.12);
  border: 1px solid var(--line);
}

.pill-ghost .mp-icon { width: 16px; height: 16px; color: var(--brand-deep); }

/* ---------- 提示 ---------- */
.tip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  padding: 8px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tip.hide { opacity: 0; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: rgba(58, 32, 14, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.22s ease;
}

.overlay[hidden] { display: none; }

.panel {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: 26px;
  padding: 0 22px 22px;
  text-align: center;
  box-shadow: 0 20px 44px rgba(58, 32, 14, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.9);
  animation: pop 0.28s cubic-bezier(0.2, 1.2, 0.4, 1);
  overflow: hidden;
}

.panel-hero {
  width: calc(100% + 44px);
  margin: 0 -22px 0;
  height: 168px;
  overflow: hidden;
  background: linear-gradient(180deg, #FFD9B8 0%, #FFE3CC 100%);
}

.panel-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

@keyframes pop {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.panel-badge {
  width: 62px;
  height: 62px;
  margin: -31px auto 10px;
  position: relative;
  z-index: 2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FFB877 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(232, 106, 28, 0.4);
  border: 3px solid #fff;
}

.panel-badge .mp-icon { width: 30px; height: 30px; }

.panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.panel p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.panel-stats {
  display: flex;
  gap: 10px;
  margin: 16px 0 4px;
}

.panel-stats[hidden] { display: none; }

.stat {
  flex: 1;
  background: var(--brand-soft);
  border-radius: 16px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stat b { font-size: 20px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }

.btn-main {
  width: 100%;
  height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFA45C 0%, var(--brand) 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 20px rgba(232, 106, 28, 0.34);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-main:active { transform: translateY(2px) scale(0.985); box-shadow: 0 5px 12px rgba(232, 106, 28, 0.3); }

.btn-ghost {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  border-radius: 23px;
  border: 1px solid var(--line);
  background: #FFF6EE;
  color: var(--brand-deep);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn-ghost[hidden] { display: none; }
.btn-ghost:active { transform: scale(0.98); background: #FFEBDC; }
.btn-ghost .mp-icon { width: 18px; height: 18px; }
