:root {
  --ink: #f3ecdf;
  --muted: #c9bfae;
  --bg: #10211b;
  --card: #1a3128;
  --line: rgba(243, 236, 223, 0.16);
  --amber: #e2a122;
  --amber-ink: #2a1c04;
  --leaf: #6eaf4c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button, input, summary { font: inherit; color: inherit; }

button { cursor: pointer; }

[hidden] { display: none !important; }

.screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% 120%, rgba(110, 175, 76, 0.18), transparent 60%),
    linear-gradient(180deg, #16352b 0%, #10211b 45%, #0c1915 100%);
}

.menu-card {
  width: min(520px, 100%);
  background: rgba(16, 33, 27, 0.9);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--amber);
}

h1, h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 680;
  letter-spacing: -0.03em;
  margin: 0;
}

h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); }

.lede, .confirm p, .help li, #pause-seed {
  color: var(--muted);
  line-height: 1.5;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.choice {
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}

.choice span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.choice.is-on {
  border-color: var(--amber);
  background: rgba(226, 161, 34, 0.12);
}

.seed-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.seed-label span, .foot { color: var(--muted); font-size: 0.82rem; }

input {
  width: 100%;
  margin: 6px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0c1915;
}

.menu-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 10px 16px;
}

.btn.primary {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
  font-weight: 650;
}

.confirm {
  margin-top: 12px;
  padding-top: 8px;
}

.help { margin-top: 16px; }

.help summary { cursor: pointer; }

.help ul { padding-left: 18px; }

.foot { margin: 16px 0 0; }

.foot a { color: var(--amber); }

#loading p {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.6rem;
}

#game {
  position: fixed;
  inset: 0;
  background: #7eb6e0;
  touch-action: none;
  user-select: none;
}

#view {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.28);
}

#game.hurt #vignette {
  box-shadow: inset 0 0 160px rgba(180, 40, 24, 0.55);
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background:
    linear-gradient(var(--ink), var(--ink)) center/2px 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) center/100% 2px no-repeat;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8));
}

#crosshair::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(var(--amber) var(--break, 0%), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%);
  mask: radial-gradient(circle, transparent 62%, #000 64%);
}

#hud-readout {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

#hud-readout p { margin: 0; font-size: 0.92rem; }

#mode-label { font-weight: 650; }

#hearts {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  letter-spacing: 2px;
  color: #e25b4a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

#toast {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  background: rgba(16, 33, 27, 0.82);
  border-radius: 999px;
  padding: 8px 14px;
  margin: 0;
}

#look-hint {
  position: absolute;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  margin: 0;
  background: rgba(16, 33, 27, 0.78);
  border-radius: 999px;
  padding: 8px 14px;
  pointer-events: none;
}

#hotbar-wrap {
  position: absolute;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#empty-hand {
  margin: 0;
  background: rgba(16, 33, 27, 0.78);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}

#hotbar {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  background: rgba(12, 22, 18, 0.72);
  border-radius: 16px;
  border: 1px solid rgba(243, 236, 223, 0.12);
}

.slot {
  position: relative;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  padding: 0;
}

.slot canvas { width: 100%; height: 100%; display: block; }

.slot.is-on { border-color: var(--amber); }

.slot .count {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 0.75rem;
  font-weight: 650;
  text-shadow: 0 1px 1px #000;
}

#touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#stick {
  pointer-events: auto;
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(12, 22, 18, 0.4);
  border: 1px solid rgba(243, 236, 223, 0.2);
}

#knob {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(243, 236, 223, 0.85);
}

#touch-actions {
  pointer-events: auto;
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(92px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#touch-actions button {
  width: 74px;
  height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(243, 236, 223, 0.25);
  background: rgba(12, 22, 18, 0.55);
}

#pause {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 14, 12, 0.62);
  padding: 16px;
  overflow: auto;
}

.pause-card h2 { font-size: 2rem; margin-bottom: 8px; }

@media (max-width: 720px) {
  .slot { width: 48px; height: 48px; }
  #look-hint { bottom: 168px; }
}
