:root {
  --bg: #12151a;
  --surface: #1c211c;
  --fg: #ebe4d6;
  --muted: #a39888;
  --torch: #e7b15a;
  --blood: #a33b32;
  --line: #3a342c;
  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
}

button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }

.game-root {
  position: relative;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  user-select: none;
}

.game-root canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgb(8 7 6 / 0.62) 100%);
}

.hurt-flash {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 25%, rgb(120 24 18 / 0.85) 100%);
  opacity: 0;
}

.exit {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}
.exit:hover { color: var(--fg); }

header {
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 10;
  padding: 1rem;
}
.meters {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.meter-block { min-width: 0; flex: 1; }
.meter-label {
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.felled {
  width: 5rem;
  flex: none;
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.status {
  margin: 0.5rem 0 0;
  text-align: center;
  font-family: var(--display);
  font-size: 1.9rem;
  color: var(--torch);
  min-height: 1.2em;
}

.meter {
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.meter-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
}
.meter-fill.health { background: var(--blood); }
.meter-fill.stamina { background: var(--torch); }

.overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
}
.overlay.center { align-items: center; }
.overlay[hidden] { display: none; }

.menu-card {
  pointer-events: auto;
  width: min(28rem, 100%);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.35);
}
.center-card { text-align: center; }
.kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--torch);
}
h1 {
  margin: 0.25rem 0 0;
  font-family: var(--display);
  font-size: 3.75rem;
  font-weight: 600;
  line-height: 1;
}
h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 2.5rem;
  font-weight: 600;
}
.blurb {
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}
.menu-card button {
  margin-top: 1.25rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.4rem;
  padding: 0.75rem 1.5rem;
  background: var(--torch);
  color: var(--bg);
  font-weight: 600;
}
.menu-card ul {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}
.menu-card li + li { margin-top: 0.25rem; }

.key-hint {
  pointer-events: none;
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 10;
  color: var(--muted);
  font-size: 0.8rem;
}
.key-hint[hidden] { display: none; }

.touch-controls {
  display: none;
  pointer-events: none;
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 10;
  padding: 1rem 1rem 1.25rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.stick {
  pointer-events: auto;
  width: 7.5rem;
  height: 7.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  position: relative;
  touch-action: none;
}
.nub {
  position: absolute;
  left: 2.35rem;
  top: 2.35rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--torch);
}
.action-col {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.action-btn {
  min-width: 5.5rem;
  min-height: 3rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  touch-action: none;
}
.action-btn.primary {
  background: var(--torch);
  color: var(--bg);
  border-color: transparent;
}

@media (min-width: 640px) {
  .overlay { align-items: center; justify-content: flex-start; padding: 2.5rem; }
  .overlay.center { justify-content: center; }
}

@media (pointer: coarse), (max-width: 800px) {
  .game-root[data-phase="play"] .touch-controls { display: flex; }
  .key-hint { display: none; }
}
