:root {
  --paper: #f4eee2;
  --paper-2: #ebe2cf;
  --ink: #2b2620;
  --ink-soft: #6b6152;
  --sea: #dfe6e0;
  --accent: #b5462f;
  --gold: #a7832f;
  --serif: "Cormorant Garamond", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

canvas#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
}
canvas#map.dragging { cursor: grabbing; }

.hidden { display: none !important; }

/* HUD */
#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}
.hud-card {
  background: rgba(244, 238, 226, 0.92);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 10px 14px;
  min-width: 230px;
}
.hud-row {
  display: flex;
  gap: 18px;
  margin-bottom: 6px;
}
.label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}
.value.small { font-size: 20px; }
.lives { font-size: 20px; letter-spacing: 3px; color: var(--accent); }
.lives .lost { color: #c9bfae; }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  margin-top: 6px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle span {
  width: 30px;
  height: 16px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  position: relative;
  background: var(--paper-2);
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}
.toggle input:checked + span { background: var(--gold); }
.toggle input:checked + span::after { transform: translateX(14px); }

button {
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
button:active { transform: translate(2px, 2px); box-shadow: none; }
button.primary {
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  padding: 12px 26px;
}
button:disabled { opacity: 0.55; cursor: wait; }
button.ghost { background: rgba(244, 238, 226, 0.92); }

#btn-drop {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 5;
  font-size: 18px;
  padding: 14px 24px;
  background: var(--ink);
  color: var(--paper);
}

#toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 14px;
  background: var(--ink);
  color: var(--paper);
  padding: 6px 14px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  z-index: 6;
}
#toast.show { opacity: 1; }

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 238, 226, 0.6);
  backdrop-filter: blur(2px);
  z-index: 10;
}
.sheet {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 34px 40px;
  max-width: 560px;
  width: calc(100% - 32px);
  text-align: left;
}
.sheet.small { max-width: 420px; text-align: center; }
.sheet.small button { margin: 6px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
h1 {
  font-size: 72px;
  margin: 4px 0 8px;
  line-height: 1;
  letter-spacing: -0.01em;
}
h2 { font-size: 34px; margin: 6px 0 10px; }
.lede { font-size: 20px; line-height: 1.35; margin: 0 0 14px; }
.how {
  font-size: 17px;
  line-height: 1.45;
  padding-left: 20px;
  margin: 0 0 16px;
  color: var(--ink-soft);
}
.how b { color: var(--ink); }
.start-toggles { margin-bottom: 20px; }
.best-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 14px 0 0;
}

@media (max-width: 600px) {
  h1 { font-size: 52px; }
  .sheet { padding: 24px; }
  .hud-card { min-width: 0; padding: 8px 10px; }
  .value { font-size: 20px; }
  #hud { top: 8px; left: 8px; }
}
