:root {
  --accent: #5aa83c;
  --accent-2: #6cbb4c;
  --text: #3a4a30;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --scene-bg1: #cdeeff;
  --scene-bg2: #a7dcff;
}

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

html, body {
  margin: 0; min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #e7f6d8 0%, #d8f0ff 55%, #ffe9f2 100%);
  background-attachment: fixed;
  -webkit-user-select: none; user-select: none;
}

.wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px); gap: 12px; }

.topbar { width: 100%; max-width: 760px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 22px; font-weight: 800; margin: 0; color: var(--accent); text-shadow: 0 2px 0 #fff; }
.back-btn, .sound-toggle {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: none;
  background: #fff; color: var(--accent); box-shadow: var(--shadow);
  font-size: 20px; font-weight: 800; text-decoration: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.back-btn:active, .sound-toggle:active { transform: scale(0.92); }
.sound-toggle.off { opacity: 0.5; }

.hud { width: 100%; max-width: 760px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-item { background: #fff; border-radius: 999px; padding: 8px 16px; font-size: 15px; font-weight: 700; box-shadow: var(--shadow); color: #6a7a56; }
.hud-item b { color: var(--accent); font-size: 17px; }
.mini-btn { border: none; background: var(--accent); color: #fff; font-weight: 800; border-radius: 999px; padding: 9px 16px; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.mini-btn:first-of-type { margin-left: auto; }
.mini-btn:active { transform: scale(0.95); }

.scenes { width: 100%; max-width: 760px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.scene {
  position: relative; flex: 1 1 300px; max-width: 360px; aspect-ratio: 1 / 1;
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
  background: linear-gradient(160deg, var(--scene-bg1), var(--scene-bg2));
  touch-action: manipulation;
}
.scene .item {
  position: absolute; transform: translate(-50%, -50%);
  pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
}
.scene .bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.marks { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute; width: 16%; aspect-ratio: 1/1; transform: translate(-50%, -50%);
  border: 4px solid #e23b3b; border-radius: 50%; box-sizing: border-box;
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
}
.mark.found { border-color: #2faa4a; animation: pop 0.35s ease; }
.mark.hint { border-color: #ffb300; animation: pulse 0.7s ease-in-out 3; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(0.4); } 60% { transform: translate(-50%,-50%) scale(1.15); } 100% { transform: translate(-50%,-50%) scale(1); } }
@keyframes pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

.miss { position: absolute; width: 10%; aspect-ratio: 1/1; transform: translate(-50%,-50%);
  color: #e23b3b; font-weight: 900; font-size: 22px; display: flex; align-items: center; justify-content: center;
  animation: fade 0.6s ease forwards; pointer-events: none; }
.miss::after { content: "✕"; }
@keyframes fade { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); } }

.tip { color: #6a7a56; font-size: 14px; font-weight: 600; margin: 2px 0 0; text-align: center; }

.overlay { position: fixed; inset: 0; background: rgba(30,40,25,.45); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.overlay[hidden] { display: none; }
.card-panel { background: #fff; border-radius: 26px; padding: 26px 22px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center; }
.card-panel h2 { margin: 0 0 16px; font-size: 24px; color: var(--accent); }
.field { text-align: left; margin-bottom: 18px; }
.field > label { display: block; font-size: 14px; color: #6a7a56; font-weight: 700; margin-bottom: 8px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn { flex: 1; min-width: 64px; border: 2px solid #cfe6bd; background: #f4fbee; color: var(--text); padding: 11px 6px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.seg-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.win-emoji { font-size: 64px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.big-btn { width: 100%; border: none; border-radius: 16px; padding: 16px; margin-top: 6px; background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow); }
.big-btn:active { transform: scale(0.97); background: var(--accent-2); }
.big-btn.ghost { background: #fff; color: var(--accent); border: 2px solid #cfe6bd; box-shadow: none; margin-top: 10px; }
