* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f5f5;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  z-index: 10;
}

#hud > div {
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

#timer-box {
  color: #e53935;
}

#game-area {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 80px;
  overflow: hidden;
}

/* Bottom candy tray */
#candy-tray {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.tray-candy {
  width: 52px;
  height: 52px;
  cursor: grab;
  touch-action: none;
  transition: transform 0.1s;
}

.tray-candy:active {
  cursor: grabbing;
}

/* Person on screen */
.person {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s;
  z-index: 5;
}

.person img {
  width: 72px;
  height: 100px;
  object-fit: contain;
  pointer-events: none;
}

.person .thought-bubble {
  background: #fff;
  border: 2px solid #bbb;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 18px;
  margin-bottom: 4px;
  animation: pop-in 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.person.happy img {
  filter: none;
}

.person.happy .thought-bubble {
  border-color: #43a047;
  background: #e8f5e9;
}

.person.leaving {
  animation: walk-off 0.5s ease-in forwards;
}

/* Floating candy (drag) */
.candy-drag {
  position: fixed;
  width: 52px;
  height: 52px;
  pointer-events: none;
  z-index: 100;
  transform: translate(-50%, -50%);
}

.candy-drag img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hidden { display: none !important; }

/* Overlay */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#result-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  min-width: 240px;
}

#result-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

#result-score {
  font-size: 18px;
  color: #555;
  margin-bottom: 24px;
}

#retry-btn {
  background: #222;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 32px;
  font-size: 16px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  cursor: pointer;
}

/* Score popup */
.score-popup {
  position: absolute;
  font-size: 20px;
  font-weight: 700;
  color: #43a047;
  pointer-events: none;
  z-index: 50;
  animation: float-up 0.8s ease forwards;
}

.miss-popup {
  color: #e53935;
}

@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes walk-off {
  to { transform: translateX(160px); opacity: 0; }
}

@keyframes float-up {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-60px); opacity: 0; }
}

@keyframes walk-in {
  from { transform: translateX(-80px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.person {
  animation: walk-in 0.4s ease;
}