* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #4ec0ca;
  font-family: -apple-system, "Segoe UI", Tahoma, Arial, sans-serif; user-select: none;
  -webkit-user-select: none; touch-action: none; }
#wrap { position: fixed; inset: 0; }
#game { display: block; width: 100%; height: 100%; touch-action: none; }

#score { position: absolute; top: calc(env(safe-area-inset-top,10px) + 12px); left: 0; right: 0;
  text-align: center; z-index: 5; pointer-events: none; font-size: 56px; font-weight: 900; color: #fff;
  text-shadow: 3px 3px 0 #543847, -2px -2px 0 #543847, 2px -2px 0 #543847, -2px 2px 0 #543847; }
#immune { position: absolute; top: calc(env(safe-area-inset-top,10px) + 14px); right: 14px; z-index: 5;
  background: rgba(0,0,0,.45); color: #b6ffce; font-weight: 900; font-size: 17px; padding: 5px 12px; border-radius: 16px; }
#immune.hidden { display: none; }

.overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(78,192,202,.92), rgba(40,120,140,.95)); color: #fff; }
.overlay.hidden { display: none; }
.overlay h1 { font-size: clamp(30px, 9vw, 46px); text-shadow: 3px 3px 0 #543847; }
.sub { font-size: 15.5px; opacity: .96; max-width: 330px; line-height: 1.5; }
.howto { display: flex; flex-direction: column; gap: 6px; font-size: 15px;
  background: rgba(0,0,0,.22); padding: 12px 18px; border-radius: 12px; }
#heroPreview { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; display: none; border: 4px solid #fff; }
#heroPreview.show { display: block; }
#nameInput { width: min(80%, 300px); padding: 12px; border-radius: 12px; border: 3px solid #fff;
  font-size: 17px; text-align: center; outline: none; background: #fff; color: #222; }
.btn { background: #f6a623; color: #fff; border: 3px solid #fff; border-radius: 13px;
  padding: 14px 32px; font-size: 19px; font-weight: 900; cursor: pointer; box-shadow: 0 5px 0 #b9740d; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b9740d; }
.btn.ghost { background: rgba(255,255,255,.16); box-shadow: 0 4px 0 rgba(0,0,0,.35); border-color: rgba(255,255,255,.55); font-size: 16px; padding: 11px 22px; }
.btn.wa { background: #25D366; box-shadow: 0 5px 0 #128C3E; }
.btn.wa:active { box-shadow: 0 1px 0 #128C3E; }
.link { background: rgba(255,255,255,.18); color: #fff; border: 2px solid rgba(255,255,255,.6);
  border-radius: 12px; padding: 9px 20px; font-size: 15px; cursor: pointer; }
.rankmsg { font-size: 16px; color: #ffe35c; font-weight: 700; min-height: 22px; }

#lbList { list-style: none; width: min(90%, 360px); max-height: 58vh; overflow-y: auto; }
#lbList li { display: flex; justify-content: space-between; gap: 10px; background: rgba(0,0,0,.25);
  margin: 6px 0; padding: 11px 15px; border-radius: 10px; font-size: 17px; font-weight: 700; }
#lbList li .rank { color: #ffe35c; min-width: 32px; text-align: center; }
#lbList li .nm { flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lbList li.me { outline: 2px solid #ffe35c; }
