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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  font-family: "Courier New", Courier, monospace;
}

#game-wrap {
  position: relative;
  width: min(96vw, 1280px);
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  background: #000;
  overflow: hidden;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Undertale-style bottom dialog */
#dialog-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 0 12px 12px;
  pointer-events: none;
}

#dialog-ui.hidden {
  display: none;
}

#dialog-box {
  background: #000;
  border: 4px solid #fff;
  min-height: 88px;
  padding: 16px 20px 24px;
  position: relative;
}

#dialog-text {
  color: #fff;
  font-size: clamp(11px, 1.7vw, 15px);
  line-height: 1.85;
  letter-spacing: 0.5px;
  white-space: pre-wrap;
}

#dialog-arrow {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: #fff;
  font-size: 14px;
  animation: blink 0.75s step-end infinite;
}

#dialog-arrow.hidden {
  display: none;
}

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

/* Floating E prompt above interactables */
#e-prompt {
  position: absolute;
  z-index: 22;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -8px;
}

#e-prompt.hidden {
  display: none;
}

#e-prompt .e-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #fff;
  color: #000;
  border: 3px solid #000;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 2px 2px 0 #000;
  image-rendering: pixelated;
}

#fade-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}

#fade-overlay.white {
  background: #fff;
}

#money-ui {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 14;
  color: #f0d878;
  font-size: clamp(12px, 1.8vw, 16px);
  font-weight: bold;
  letter-spacing: 1px;
  pointer-events: none;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
  padding: 6px 10px;
  border: 3px solid #fff;
  background: rgba(0, 0, 0, 0.65);
}

#money-ui.hidden {
  display: none;
}

#controls-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  font-size: clamp(9px, 1.3vw, 11px);
  line-height: 1.8;
  z-index: 12;
  pointer-events: none;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
}

#controls-hint.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

#load-error {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #f88;
  font-size: 14px;
  text-align: center;
  max-width: 90%;
}
