html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #fff;
}

canvas {
  display: block;
}

#hud {
  position: fixed;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 10;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

#hud .label {
  font-weight: 700;
  margin-right: 6px;
}

#overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  background: rgba(0, 0, 0, 0.6);
  z-index: 20;
  text-align: center;
}

#overlay.show {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#message {
  font-size: 1.4rem;
  max-width: 70ch;
  line-height: 1.4;
}

#controls {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  z-index: 10;
  pointer-events: auto;
}

.dpad {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 1rem;
}

.btn:active {
  background: #444;
}

#modeToggle input {
  margin-right: 6px;
}

/* Mobile-friendly tap targets */
@media (max-width: 768px) {
  .btn {
    padding: 14px 18px;
    font-size: 1.1rem;
  }
}

/* Minimal focus for accessibility */
.btn:focus-visible {
  outline: 2px solid #77f;
}

/* Note popup */
.note-popup {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  background: rgba(0, 0, 0, 0.7);
  z-index: 30;
}

.note-popup.show {
  display: flex;
}

.note-content {
  background: #2a2a2a;
  border: 2px solid #555;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #444;
  color: #fff;
  border: 1px solid #666;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.close-btn:hover {
  background: #555;
}

.close-btn:active {
  background: #666;
}

.note-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #ddd;
  white-space: pre-wrap;
  padding-top: 8px;
}

/* Story Popup */
.story-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  flex-direction: column;
}

.story-content {
  max-width: 600px;
  text-align: center;
  color: #eee;
  padding: 40px;
  font-family: 'Courier New', Courier, monospace;
}

.story-content p {
  font-size: 1.4rem;
  margin-bottom: 24px;
  opacity: 0.9;
  letter-spacing: 1px;
}

.story-content button {
  margin-top: 30px;
  background: #333;
  border: 1px solid #666;
  color: #fff;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.story-content button:hover {
  background: #555;
  transform: scale(1.05);
}