:root {
  --ink: #1d2417;
  --panel: #2f3a24;
  --panel-2: #3d4a2e;
  --line: #8ea36b;
  --accent: #e0b352;
  --text: #f3efe2;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: #171d12;
  color: var(--text);
  font: 15px/1.45 "Trebuchet MS", Verdana, sans-serif;
}
#app {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 12px;
  gap: 10px;
  grid-template-rows: auto 1fr auto;
}
#hud {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-weight: 700;
  letter-spacing: .2px;
  min-height: 40px;
  width: min(92vw, 800px);
}
#hud .spacer { flex: 1 1 auto; }
.icon-btn {
  min-height: 34px; padding: 4px 10px; font-size: 15px; line-height: 1;
}
.error {
  max-width: 720px; margin: 0 auto;
  border: 2px solid #c8623a; border-radius: 6px;
  background: #3a2318; color: #ffd9c2;
  padding: 10px 14px; font-size: 14px;
}
.help { margin: 10px 0 0; font-size: 13px; color: #dbe3cd; }
.help summary { cursor: pointer; font-weight: 700; color: var(--text); }
.help ul { margin: 8px 0 0; padding-left: 20px; }
.help li { margin: 5px 0; }
.help b { color: var(--accent); }
#hud span { white-space: nowrap; }
#hud-status { color: var(--accent); }
#stage {
  width: min(94vw, 74vh * (800 / 600));
  max-width: 800px;
  height: auto;
  aspect-ratio: 800 / 600;
  image-rendering: pixelated;
  background: #101408;
  border: 3px solid #24301a;
  border-radius: 4px;
  touch-action: none;
}
#overlay {
  position: fixed; inset: 0;
  display: none;
  place-items: center;
  background: rgba(12, 16, 8, .72);
  padding: 16px;
  z-index: 5;
}
#overlay.show { display: grid; }
.panel {
  width: min(560px, 94vw);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px 20px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.panel.hidden, .hidden { display: none !important; }
h1 { margin: 0 0 2px; font-size: 26px; letter-spacing: .3px; }
h2 { margin: 0 0 8px; font-size: 20px; }
.sub { margin: 0 0 14px; color: #cfd8bd; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
button {
  font: inherit; font-weight: 700;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  cursor: pointer;
  min-height: 42px;
}
button:hover, button:focus-visible { background: #4c5c3a; outline: none; }
button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button.small { padding: 5px 9px; min-height: 34px; font-size: 13px; }
.help { margin: 6px 0 0; color: #d9e0ca; font-size: 13px; }
.note { margin: 12px 0 0; color: #b4bfa2; font-size: 12px; }
#levelButtons { max-height: 136px; overflow: auto; }
#touch {
  display: grid; gap: 6px; justify-items: center;
  user-select: none;
}
#touch > div { display: flex; gap: 6px; }
#touch button { width: 64px; height: 52px; font-size: 20px; }
@media (hover: hover) and (pointer: fine) { #touch { display: none !important; } }
