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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d0f14;
  font-family: "Press Start 2P", monospace;
  -webkit-font-smoothing: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: default;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(8, 10, 6, 0.38) 100%);
}

.hidden { display: none !important; }

/* ---------- Loading screen ---------- */
#loading {
  position: fixed;
  inset: 0;
  background: #0d0f14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  z-index: 30;
  transition: opacity 0.6s ease;
}
#loading.fade { opacity: 0; pointer-events: none; }

#loading-title {
  color: #ffd561;
  font-size: clamp(12px, 2.8vw, 24px);
  text-shadow: 4px 4px 0 #3a2c10;
  letter-spacing: 1px;
  text-align: center;
  padding: 0 16px;
  line-height: 1.6;
}

#loading .bar {
  width: min(320px, 70vw);
  height: 22px;
  border: 4px solid #e8e3d0;
  background: #1c2333;
  padding: 3px;
  box-shadow: 0 0 0 4px #0d0f14, 0 0 0 6px #3a3f4d;
}
#loading .fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(90deg, #6fbf55 0 8px, #5aa843 8px 16px);
  transition: width 0.15s steps(6);
}

#loading .step {
  color: #8b93a7;
  font-size: 10px;
  min-height: 12px;
}

#loading .start {
  color: #e8e3d0;
  font-size: clamp(10px, 1.7vw, 14px);
  animation: blink 1.1s steps(2) infinite;
  cursor: pointer;
  text-align: center;
  padding: 0 16px;
}

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

/* ---------- Dialog ---------- */
#dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 26px;
  pointer-events: auto;
  background: transparent;
}

.dlg-box {
  pointer-events: auto;
  position: relative;
  width: min(680px, 96vw);
  background: #1c2333;
  border: 4px solid #e8e3d0;
  box-shadow: 0 0 0 4px #10131c, 6px 8px 0 rgba(0, 0, 0, 0.45);
  padding: 18px 20px 26px;
  color: #e8e3d0;
  cursor: pointer;
}

.dlg-title {
  color: #ffd561;
  font-size: 13px;
  margin-bottom: 14px;
  text-shadow: 2px 2px 0 #3a2c10;
}

.dlg-text {
  font-size: 11px;
  line-height: 1.9;
  min-height: 64px;
  word-wrap: break-word;
}
.dlg-text a { color: #7fd1ff; }
.dlg-text a:hover { color: #b8e6ff; }
.dlg-text b { color: #ffe08a; }
.dlg-text i { color: #9aa3b8; }

.dlg-next {
  position: absolute;
  right: 14px;
  bottom: 8px;
  color: #ffd561;
  font-size: 12px;
  animation: bob 0.8s steps(2) infinite;
}
@keyframes bob { 50% { transform: translateY(3px); } }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 10;
  color: #d7dbe6;
  background: rgba(13, 15, 20, 0.62);
  border: 2px solid rgba(232, 227, 208, 0.35);
  padding: 8px 10px;
  font-size: 8px;
  line-height: 1.6;
  pointer-events: none;
}
#hud .key { color: #ffd561; }

@media (max-width: 640px) {
  #hud { display: none; }
  .dlg-text { font-size: 10px; }
}
