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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top, #1a3a6a 0%, transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(196, 30, 58, 0.35), transparent 40%),
    linear-gradient(160deg, #0b1d36 0%, #1a0a14 45%, #3d0f18 100%);
  font-family: 'Press Start 2P', monospace;
  color: #fff8ef;
  image-rendering: pixelated;
}

#game-container {
  position: relative;
  border: 4px solid #e8c36a;
  border-radius: 8px;
  box-shadow:
    0 0 0 4px #14080c,
    0 0 40px rgba(196, 30, 58, 0.35),
    inset 0 0 60px rgba(0, 0, 0, 0.3);
  background: #14080c;
}

#home-link {
  position: absolute;
  top: -28px;
  left: 0;
  font-size: 7px;
  color: #e8c36a;
  text-decoration: none;
}

#home-link:hover {
  color: #fff;
}

#fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20;
  font-family: inherit;
  font-size: 7px;
  line-height: 1;
  padding: 8px 10px;
  color: #fff8ef;
  background: #c41e3a;
  border: 2px solid #e8c36a;
  border-radius: 4px;
  cursor: pointer;
  text-shadow: 1px 1px 0 #000;
}

#fullscreen-btn:hover,
#fullscreen-btn:focus-visible {
  background: #e8c36a;
  color: #1a120c;
  text-shadow: none;
}

#game-container:fullscreen,
#game-container:-webkit-full-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #0b0810;
}

#game-container:fullscreen #game,
#game-container:-webkit-full-screen #game {
  width: min(100vw, calc(100vh * 800 / 480));
  height: min(100vh, calc(100vw * 480 / 800));
}

#game-container:fullscreen #home-link,
#game-container:-webkit-full-screen #home-link,
#game-container:fullscreen #controls-help,
#game-container:-webkit-full-screen #controls-help {
  display: none;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

.hud-row {
  display: flex;
  gap: 20px;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 #000;
  font-size: 8px;
  line-height: 1.6;
}

#quest-label {
  font-size: 7px;
  color: #ffd166;
  text-shadow: 2px 2px 0 #000;
  line-height: 1.6;
  max-width: 78%;
}

#message-box {
  margin-top: 4px;
  font-size: 7px;
  color: #95d5b2;
  text-shadow: 2px 2px 0 #000;
  min-height: 16px;
}

#overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 10, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  background: #2a1020;
  border: 4px solid #e8c36a;
  padding: 24px;
  max-width: 92%;
  font-size: 8px;
  line-height: 2;
  text-align: center;
}

#overlay-content h2 {
  color: #e8c36a;
  margin-bottom: 16px;
  font-size: 12px;
}

#overlay-content p {
  color: #f4e4c8;
  margin-bottom: 8px;
}

#overlay-content button {
  font-family: inherit;
  font-size: 8px;
  padding: 10px 20px;
  margin: 8px;
  background: #c41e3a;
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
}

#overlay-content button:hover {
  background: #e8c36a;
  color: #1a120c;
}

#controls-help {
  position: absolute;
  bottom: -36px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 6px;
  color: #c9a227;
}

#controls-help kbd {
  background: #3d1020;
  padding: 2px 4px;
  border-radius: 2px;
  border: 1px solid #e8c36a;
}
