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

body {
  background: #111;
  color: #fff;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Hiragino Maru Gothic Pro', 'BIZ UDPGothic', sans-serif;
}

#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  display: block;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 20;
}

.overlay.hidden { display: none; }

.overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.overlay-inner.hidden { display: none; }

.big-emoji { font-size: 3.5rem; }

.ov-title {
  font-size: 2.2rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.ov-score, .ov-best {
  font-size: 1.2rem;
  opacity: 0.85;
}

.ov-hint {
  font-size: 0.95rem;
  opacity: 0.55;
  margin-top: 8px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; }
}

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 8px 20px;
  background: rgba(0,0,0,0.4);
  z-index: 10;
  pointer-events: none;
}

.hud.hidden { display: none; }

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hud-label {
  font-size: 0.68rem;
  opacity: 0.55;
}

#score, #best {
  font-size: 1.3rem;
  font-weight: bold;
}

.perfect-msg {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: bold;
  color: #ffe000;
  text-shadow: 0 0 20px #ffaa00;
  pointer-events: none;
  z-index: 30;
  animation: msgPop 0.3s ease-out;
}

.perfect-msg.hidden { display: none; }

@keyframes msgPop {
  from { transform: translate(-50%, -50%) scale(0.4); }
  to   { transform: translate(-50%, -50%) scale(1); }
}
