/* 找不同 · 卡通游戏界面 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #4B3A2F;
  background: #FFF4E6;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 6%, rgba(255, 138, 61, 0.20), transparent 38%),
    radial-gradient(circle at 94% 14%, rgba(95, 179, 168, 0.20), transparent 36%),
    radial-gradient(circle at 50% 104%, rgba(255, 138, 61, 0.12), transparent 46%),
    #FFF4E6;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(rgba(180, 140, 100, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
}

/* ---------------- 顶部 HUD ---------------- */
.hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
}
.hud-pill {
  display: flex;
  align-items: baseline;
  border-radius: 999px;
  white-space: nowrap;
}
.level-pill {
  gap: 2px;
  padding: 6px 15px 6px 12px;
  color: #fff;
  background: linear-gradient(180deg, #FFB169, #FF8A3D);
  box-shadow: 0 3px 0 #DB6B26, 0 7px 16px rgba(255, 138, 61, 0.32);
}
.level-pill .lv-cap {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.04em;
}
.level-pill b {
  font-size: 21px;
  line-height: 1;
  margin: 0 2px;
  font-variant-numeric: tabular-nums;
}
.timer-pill {
  margin-left: auto;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  background: #FFFDF8;
  color: #4B3A2F;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 0 rgba(128, 88, 54, 0.12), 0 5px 12px rgba(128, 88, 54, 0.08);
}
.timer-pill .mp-icon {
  width: 16px;
  height: 16px;
  color: #FF8A3D;
}
.round-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #FFFDF8;
  color: #7A5A3E;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(128, 88, 54, 0.14), 0 5px 12px rgba(128, 88, 54, 0.10);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  padding: 0;
}
.round-btn .mp-icon {
  width: 20px;
  height: 20px;
}
.round-btn:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 1px 0 rgba(128, 88, 54, 0.14);
}

/* ---------------- 进度条 ---------------- */
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 20px;
  padding: 0 3px;
  font-size: 12.5px;
  color: #8B7561;
}
.status-text b {
  color: #FF8A3D;
  font-size: 14px;
  margin: 0 1px;
}
.dots {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 4px;
}
.dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #EBD8C4;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.dot.on {
  background: #FF8A3D;
  box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.16);
  transform: scale(1.06);
}
.status-count {
  margin-left: auto;
  font-size: 12px;
  color: #A69280;
  font-variant-numeric: tabular-nums;
}
.status-count b {
  color: #4B3A2F;
  font-size: 14px;
}

/* ---------------- 画面 ---------------- */
.boards {
  flex: 1;
  min-height: 240px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}
.board {
  position: relative;
  flex: none;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 9px 20px rgba(88, 52, 24, 0.16);
  transform: translateZ(0);
}
.board canvas {
  display: block;
  border-radius: 15px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}
.board.shake {
  animation: shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ---------------- 底部操作 ---------------- */
.foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: 46px;
}
.hint-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFA55F, #FF8A3D);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 3px 0 #D96F2A, 0 9px 18px rgba(255, 138, 61, 0.26);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hint-btn .mp-icon {
  width: 19px;
  height: 19px;
}
.hint-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #D96F2A;
}
.hint-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hint-btn.empty .hint-count {
  background: rgba(255, 255, 255, 0.18);
  color: #FFE7D3;
}
.scene-name {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 11.5px;
  color: #A8917D;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 弹层 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(58, 34, 18, 0.44);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  animation: fadeIn 0.2s ease;
}
[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.win-card {
  position: relative;
  width: 100%;
  max-width: 332px;
  padding: 24px 22px 22px;
  border-radius: 28px;
  border: 3px solid #fff;
  background: linear-gradient(180deg, #FFFDF7, #FFF3E2);
  text-align: center;
  box-shadow: 0 24px 60px rgba(60, 30, 10, 0.35);
  animation: pop 0.42s cubic-bezier(0.18, 1.5, 0.4, 1);
}
@keyframes pop {
  from { transform: scale(0.82) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.win-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  margin-bottom: 4px;
}
.win-star {
  width: 44px;
  height: 44px;
  color: #EADBC9;
  animation: starPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.win-star.lit {
  color: #FFB020;
  filter: drop-shadow(0 4px 6px rgba(255, 160, 40, 0.35));
}
.win-star.dim {
  opacity: 0.5;
}
@keyframes starPop {
  0% { transform: scale(0.3) rotate(-18deg); opacity: 0; }
  70% { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.win-title {
  margin: 2px 0 6px;
  font-size: 22px;
  color: #4B3A2F;
  letter-spacing: -0.01em;
}
.win-sub {
  margin: 0 0 8px;
  font-size: 13px;
  color: #8A7462;
}
.win-best {
  margin-bottom: 18px;
  font-size: 11.5px;
  color: #B6A08C;
}
.primary-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFA55F, #FF8A3D);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 0 #D96F2A, 0 10px 20px rgba(255, 138, 61, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.primary-btn .mp-icon { width: 20px; height: 20px; }
.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #D96F2A;
}
.primary-btn.compact {
  flex: 1;
  width: auto;
  height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 14px;
}

.modal-card {
  width: 100%;
  max-width: 318px;
  padding: 22px;
  border-radius: 24px;
  border: 3px solid #fff;
  background: #FFFDF8;
  text-align: center;
  box-shadow: 0 22px 50px rgba(60, 30, 10, 0.32);
  animation: pop 0.34s cubic-bezier(0.18, 1.5, 0.4, 1);
}
.ad-badge {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #FFF0DF;
  color: #FF8A3D;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 2px rgba(255, 138, 61, 0.16);
}
.ad-badge .mp-icon { width: 28px; height: 28px; }
.modal-title {
  margin: 0 0 6px;
  font-size: 18px;
  color: #4B3A2F;
}
.modal-text {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: #8A7462;
}
.modal-actions { display: flex; gap: 10px; }
.ghost-btn {
  flex: 1;
  height: 46px;
  border-radius: 14px;
  border: 2px solid #F0DFC9;
  background: #fff;
  color: #8A7462;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}
.ghost-btn:active { background: #FFF6EA; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: 82vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(58, 38, 22, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-height: 680px) {
  .app { padding-top: calc(8px + env(safe-area-inset-top)); gap: 6px; }
  .foot { height: 44px; }
  .hint-btn { height: 42px; }
  .round-btn { width: 40px; height: 40px; }
  .hud { min-height: 42px; }
}
