html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #6fbf73;
  font-family: sans-serif;
  touch-action: none;
  user-select: none;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

#message {
  position: fixed;
  top: 76px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0 12px;
  text-align: center;
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

#craft {
  position: fixed;
  left: 50%;
  top: 50%; /* 実際の位置は game.js が川の真ん中に合わせる */
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: 92%;
}

#craft[hidden] {
  display: none;
}

#craft button {
  padding: 10px 16px;
  border: 2px solid #fff;
  border-radius: 8px;
  background: rgba(154, 106, 53, 0.92);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  touch-action: none;
}

#craft button:disabled {
  background: rgba(60, 60, 60, 0.75);
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.5);
}

#dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}

#dialog[hidden] {
  display: none;
}

.dialog-box {
  max-width: 80%;
  padding: 24px;
  border: 3px solid #fff;
  border-radius: 8px;
  background: #1b2a49;
  color: #fff;
  text-align: center;
}

.dialog-box p {
  margin: 0 0 16px;
  font-size: 1.2rem;
  white-space: pre-line;
}

#dialog-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

#dialog-buttons button {
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  background: #4da3ff;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
}

#dialog-buttons button.danger {
  background: #d9534f;
}

#dialog-buttons button img {
  display: block;
  width: 48px;
  margin: 0 auto 6px;
  image-rendering: pixelated;
}

#inventory {
  position: fixed;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

#inventory .slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.85rem;
}

#inventory img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
}

#inventory .full {
  color: #8dffa0;
}

#mute {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  font-size: 1.3rem;
  touch-action: none;
}

/* 持ち物が増えても右上の音ボタンにかからないよう、折り返す */
#inventory {
  flex-wrap: wrap;
  max-width: calc(100% - 76px);
  gap: 6px;
}

@media (max-width: 480px) {
  #inventory .slot {
    min-width: 38px;
    padding: 2px 4px;
    font-size: 0.75rem;
  }

  #inventory img {
    width: 28px;
    height: 28px;
  }
}
