html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080909;
  color: #e8e3d5;
  font-family: Arial, Helvetica, sans-serif;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #111313;
  cursor: crosshair;
}

#hud {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  pointer-events: none;
  color: #f2ead7;
  text-shadow: 0 1px 2px #000;
}

#fadeOverlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity 550ms ease;
}

#fadeOverlay.is-visible {
  opacity: 1;
}

.endgame-overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  gap: 18px;
  padding: 28px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.72);
  text-align: center;
}

.endgame-overlay[hidden] {
  display: none;
}

.endgame-message {
  max-width: min(680px, calc(100vw - 56px));
  color: #f8efd9;
  font-size: 28px;
  line-height: 1.25;
  text-shadow: 0 2px 4px #000;
}

.endgame-replay {
  justify-self: center;
  min-width: 132px;
  min-height: 38px;
  border: 1px solid rgba(214, 190, 130, 0.72);
  border-radius: 6px;
  background: rgba(82, 58, 22, 0.94);
  color: #f8efd9;
  font: 15px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.endgame-replay:hover,
.endgame-replay:focus-visible {
  background: rgba(112, 78, 28, 0.98);
  outline: none;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  max-width: 100%;
}

.hud-row span,
#messageLog,
.debug-level-loader {
  background: rgba(12, 13, 12, 0.76);
  border: 1px solid rgba(214, 190, 130, 0.32);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  line-height: 1.25;
}

.debug-level-loader {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  pointer-events: auto;
}

.debug-level-loader label {
  font-size: 13px;
}

.debug-checkbox {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  user-select: none;
}

.debug-level-loader input {
  width: 48px;
  min-height: 24px;
  box-sizing: border-box;
  border: 1px solid rgba(214, 190, 130, 0.46);
  border-radius: 4px;
  background: rgba(6, 7, 7, 0.86);
  color: #f2ead7;
  font: inherit;
  text-align: center;
}

.debug-level-loader input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  accent-color: #d6be82;
}

.debug-level-loader button {
  min-height: 24px;
  border: 1px solid rgba(214, 190, 130, 0.52);
  border-radius: 4px;
  background: rgba(72, 54, 24, 0.88);
  color: #f2ead7;
  font: inherit;
  cursor: pointer;
}

.debug-level-loader button:hover {
  background: rgba(96, 70, 30, 0.94);
}

#messageLog {
  margin-top: 8px;
  width: min(520px, calc(100vw - 42px));
  min-height: 22px;
}

#errorPanel {
  position: fixed;
  inset: 18px;
  z-index: 5;
  overflow: auto;
  padding: 18px;
  border: 1px solid #b85f4f;
  border-radius: 8px;
  background: rgba(33, 14, 12, 0.96);
  color: #ffe1d9;
  white-space: pre-wrap;
  font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
