* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0b0e1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

#game-wrap { position: relative; width: 100%; height: 100%; }

#game { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: 14px 16px;
  pointer-events: none;
}
.hud-left, .hud-right { display: flex; gap: 10px; align-items: flex-start; }
.hud-pill {
  background: rgba(10, 12, 30, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.15);
  letter-spacing: 0.5px;
}
.hud-pill.btn { pointer-events: auto; cursor: pointer; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 30%, rgba(48, 28, 110, 0.92), rgba(8, 10, 24, 0.96));
  color: #fff;
  text-align: center;
  padding: 24px;
  z-index: 10;
}

.title {
  font-size: clamp(44px, 9vw, 84px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 2px;
  background: linear-gradient(180deg, #ffe259, #ffa751);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.45));
}
.title span { color: #fff; -webkit-text-fill-color: #fff; }
.title.small { font-size: clamp(36px, 7vw, 60px); }

.subtitle { font-size: 17px; opacity: 0.85; }

/* ---------- Avatar ---------- */
.avatar-zone { display: flex; flex-direction: column; align-items: center; gap: 10px; }
#avatar-preview {
  width: 110px; height: 110px;
  border-radius: 50%;
  border: 4px solid #ffd75e;
  background: #1c2240 center/cover no-repeat;
  box-shadow: 0 0 30px rgba(255, 215, 94, 0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 54px;
  overflow: hidden;
}
#avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.hint { font-size: 12px; opacity: 0.55; max-width: 300px; }
.upload-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- Buttons ---------- */
.btn-primary {
  font-size: 24px; font-weight: 900;
  padding: 16px 56px;
  border: none; border-radius: 999px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: #052e16;
  cursor: pointer;
  box-shadow: 0 6px 0 #14532d, 0 12px 28px rgba(0,0,0,0.4);
  transition: transform 0.08s;
  letter-spacing: 1px;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #14532d; }

.btn-secondary {
  font-size: 15px; font-weight: 700;
  padding: 10px 24px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.18); }

.controls-help {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  font-size: 13px; opacity: 0.65; margin-top: 6px;
}

/* ---------- Game over ---------- */
#go-face {
  width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid #ff5e5e;
  background: #1c2240 center/cover no-repeat;
  box-shadow: 0 0 30px rgba(255, 94, 94, 0.5);
}
.go-stats {
  background: rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 14px 30px;
  min-width: 240px;
}
.go-row {
  display: flex; justify-content: space-between; gap: 40px;
  font-size: 18px; padding: 5px 0;
}
.go-row b { color: #ffd75e; }
#new-best {
  font-size: 20px; font-weight: 900; color: #4ade80;
  animation: pulse 0.8s infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
