* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #1a1208;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}
#wrap {
  position: relative;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
#game {
  display: block;
  width: min(100vw, calc(100vh * 390 / 700));
  height: min(100vh, calc(100vw * 700 / 390));
  max-width: 100%; max-height: 100%;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  background: #87c6e8;
}
#muteBtn {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 6;
  width: 40px; height: 40px;
  border: none; border-radius: 10px;
  background: rgba(0,0,0,.35);
  font-size: 18px;
  cursor: pointer;
}
#hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 0; right: 0;
  pointer-events: none;
  z-index: 2;
  padding: 0 12px;
}
#hud-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: min(100vw, calc(100vh * 390 / 700));
  margin: 0 auto;
  gap: 8px;
}
.collect {
  display: flex; align-items: center; gap: 2px;
  min-width: 72px;
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  color: #fff;
  font-weight: 800;
  font-size: clamp(15px, 4vw, 19px);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}
.collect .times { opacity: .85; font-size: .85em; }
.icon {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
}
.icon.white-bone {
  background:
    radial-gradient(circle at 30% 35%, #fff 0 28%, transparent 30%),
    radial-gradient(circle at 70% 35%, #fff 0 28%, transparent 30%),
    radial-gradient(circle at 30% 70%, #fff 0 28%, transparent 30%),
    radial-gradient(circle at 70% 70%, #fff 0 28%, transparent 30%),
    linear-gradient(90deg, transparent 22%, #f2f2f2 22% 78%, transparent 78%);
}
.icon.gold-bone {
  background:
    radial-gradient(circle at 30% 35%, #ffe566 0 28%, transparent 30%),
    radial-gradient(circle at 70% 35%, #ffe566 0 28%, transparent 30%),
    radial-gradient(circle at 30% 70%, #ffe566 0 28%, transparent 30%),
    radial-gradient(circle at 70% 70%, #ffe566 0 28%, transparent 30%),
    linear-gradient(90deg, transparent 22%, #ffd000 22% 78%, transparent 78%);
  box-shadow: 0 0 8px rgba(255,200,0,.7);
}
#score-wrap { flex: 1; text-align: center; }
#score {
  font-size: clamp(32px, 7.5vw, 48px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
  line-height: 1;
}
#best {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  min-height: 1.2em;
}
#hintBar {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  pointer-events: none;
  z-index: 2;
}
#overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 12, 6, .45);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 4; padding: 20px;
}
#overlay.show { opacity: 1; pointer-events: auto; }
.panel {
  width: min(320px, 92vw);
  background: linear-gradient(180deg, #fff8ee, #ffe4b8);
  border-radius: 20px;
  padding: 26px 20px 20px;
  text-align: center;
  border: 2px solid rgba(180,110,40,.22);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.panel h1 {
  font-size: 30px;
  color: #5c3a14;
  font-weight: 900;
}
.tag { margin-top: 6px; color: #8a6238; font-weight: 700; font-size: 14px; }
.hint { margin-top: 12px; color: #6b5538; font-size: 13px; }
#startBtn {
  margin-top: 16px;
  border: none; border-radius: 999px;
  padding: 14px 36px;
  font-size: 18px; font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #ff9f43, #e67e22);
  box-shadow: 0 6px 0 #c46510, 0 10px 20px rgba(230,126,34,.35);
  cursor: pointer;
}
#startBtn:active { transform: translateY(3px); box-shadow: 0 3px 0 #c46510; }
.foot {
  margin-top: 14px;
  min-height: 1.4em;
  color: #5c3a14;
  font-weight: 700;
  font-size: 14px;
  white-space: pre-line;
}
