body {
  margin: 0;
  background: #0b0b0b;
  color: #ddd;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 16px;
}

#game {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 10;
  background: #000;
  border: 1px solid #333;
  overflow: hidden;
  user-select: none;
}

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

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  pointer-events: none;
}

#hud {
  position: absolute;
  left: 12px;
  top: 12px;
  pointer-events: none;
}

#timer {
  font-size: 28px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 6px #000;
}

#timer.danger {
  color: #ff3b3b;
  animation: blink 1s infinite;
}

#inventory {
  margin-top: 6px;
  font-size: 14px;
  text-shadow: 0 0 4px #000;
}

#hint {
  position: absolute;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 15px;
  pointer-events: none;
  white-space: nowrap;
}

#message {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  text-align: center;
  background: rgba(0, 0, 0, 0.75);
  padding: 12px;
  border-radius: 8px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

#message.visible {
  opacity: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.85);
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.overlay h1,
.overlay h2 {
  margin: 0;
  color: #e8e0d0;
}

button {
  padding: 12px 24px;
  font-size: 16px;
  background: #7a1f1f;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: #9a2a2a;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

input {
  padding: 10px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #222;
  color: #fff;
}

#note-text {
  max-width: 640px;
  max-height: 55%;
  overflow-y: auto;
  text-align: left;
  white-space: pre-line;
  line-height: 1.7;
  padding: 16px;
  background: #111;
  border: 1px solid #444;
  font-family: Georgia, serif;
  color: #d8cfbf;
}

#save-box {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

#ranking {
  width: 100%;
  max-width: 960px;
  background: #151515;
  padding: 16px 20px;
  border-radius: 8px;
  box-sizing: border-box;
}

#rank-list li {
  margin: 6px 0;
}

@keyframes blink {
  50% {
    opacity: 0.4;
  }
}

@media (max-width: 600px) {
  #timer {
    font-size: 22px;
  }
  #hint {
    font-size: 13px;
  }
}
