:root {
  --bg: #101820;
  --text: #f2ece2;
  --muted: #a8b4a8;
  --accent: #e8a35c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Cormorant Garamond", Georgia, serif;
}

body {
  overflow: hidden;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(72, 104, 88, 0.35), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(40, 56, 72, 0.5), transparent 50%),
    var(--bg);
}

#game-canvas {
  display: block;
  border-radius: 4px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  /* Canvas is upscaled by an integer factor (see bindResize). Nearest-neighbor
     keeps pixel art crisp instead of bilinearly blurring it. */
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(8, 12, 16, 0.58);
  backdrop-filter: blur(6px);
}

.screen.hidden,
.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "Jura", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  font-weight: 600;
  letter-spacing: 0.04em;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 6vw, 3rem);
}

.lede,
#end-body {
  max-width: 34rem;
  margin: 0 0 28px;
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  line-height: 1.55;
  color: #ddd4c8;
}

.menu-help-btn {
  position: absolute;
  top: 18px;
  right: 22px;
}

.help-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(232, 163, 92, 0.35);
  border-radius: 50%;
  background: rgba(8, 12, 16, 0.55);
  color: var(--text);
  font-family: "Jura", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.help-btn:hover {
  background: rgba(232, 163, 92, 0.18);
  border-color: rgba(232, 163, 92, 0.65);
}

#help-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 16, 0.62);
  backdrop-filter: blur(6px);
}

#help-screen.hidden {
  display: none !important;
}

.help-panel {
  position: relative;
  max-width: 26rem;
  margin: 0 20px;
  padding: 28px 32px;
  background: rgba(16, 24, 32, 0.96);
  border: 1px solid rgba(232, 163, 92, 0.28);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.help-panel h2 {
  margin: 0 0 16px;
  font-size: clamp(1.6rem, 4vw, 2rem);
}

.help-panel p {
  margin: 0 0 10px;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  line-height: 1.5;
  color: #ddd4c8;
}

.help-panel p:last-child {
  margin-bottom: 0;
}

.help-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.help-close:hover {
  color: var(--text);
}

.btn {
  padding: 14px 34px;
  border: 1px solid rgba(232, 163, 92, 0.45);
  border-radius: 999px;
  background: rgba(232, 163, 92, 0.12);
  color: var(--text);
  font-family: "Jura", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn:hover {
  background: rgba(232, 163, 92, 0.22);
  border-color: rgba(232, 163, 92, 0.75);
  transform: translateY(-1px);
}

#hud {
  position: absolute;
  bottom: 18px;
  right: 22px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: "Jura", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: rgba(242, 236, 226, 0.55);
  pointer-events: none;
}

.atmosphere-readout {
  color: rgba(232, 163, 92, 0.75);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dev-note {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.gamepad-debug {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 20;
  margin: 0;
  padding: 10px 12px;
  max-width: min(92vw, 520px);
  font-family: "Jura", monospace;
  font-size: 0.68rem;
  line-height: 1.45;
  letter-spacing: 0.04em;
  color: rgba(242, 236, 226, 0.88);
  background: rgba(8, 10, 14, 0.82);
  border: 1px solid rgba(232, 163, 92, 0.35);
  border-radius: 6px;
  pointer-events: none;
  white-space: pre-wrap;
}

.gamepad-debug.hidden {
  display: none;
}

@media (max-width: 640px) {
  #hud {
    bottom: 12px;
    right: 14px;
  }
}
