:root {
  --text: #fff6e8;
  --panel: #3a2c4a;
  --light: #7a63a0;
  --dark: #1d1426;
  --gold: #f5b83a;
  --pixel: 'Press Start 2P', monospace;
  --body: 'VT323', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #2a2236;
  color: var(--text);
  font: 20px/1.15 var(--body);
  -webkit-user-select: none;
  user-select: none;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }

.panel {
  background: var(--panel);
  border: 4px solid #000;
  box-shadow: inset 4px 4px 0 var(--light), inset -4px -4px 0 var(--dark);
  text-shadow: 2px 2px 0 #000;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-width: 44px;
  height: 44px;
  background: #5a4478;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #9a82c4, inset -3px -3px 0 #2a1d3a;
  font-size: 22px;
  text-shadow: 2px 2px 0 #000;
  touch-action: manipulation;
}
button:active { box-shadow: inset -3px -3px 0 #9a82c4, inset 3px 3px 0 #2a1d3a; }
button.go { background: #2f8a4c; box-shadow: inset 3px 3px 0 #6fd38d, inset -3px -3px 0 #164a27; padding: 0 18px; }

#top {
  position: fixed;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 14px;
  font-size: 24px;
  pointer-events: none;
}
h1 { margin: 0; font: 13px/1.4 var(--pixel); color: var(--gold); }
#corner { position: fixed; top: 10px; right: 10px; display: flex; gap: 6px; }
#helpbtn { font: 16px var(--pixel); color: var(--gold); }

#toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  font: 18px var(--pixel);
  color: #ffd2c8;
  text-shadow: 3px 3px 0 #000;
  pointer-events: none;
}
#loading { position: fixed; inset: 0; display: grid; place-items: center; font: 14px var(--pixel); color: var(--gold); }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 12px; background: #0008; }
.overlay[hidden], [hidden] { display: none !important; }
.card { width: min(480px, 100%); max-height: 100%; overflow: auto; padding: 18px 20px; font-size: 21px; text-align: left; }
.card h2 { margin: 0 0 10px; font: 15px/1.4 var(--pixel); color: var(--gold); }
.card p { margin: 0 0 12px; }
.card .go { display: block; margin: 6px auto 0; }
.legend { list-style: none; padding: 0; margin: 0 0 12px; }
.legend li { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; align-items: center; padding: 3px 0; }
kbd { font: 17px var(--body); padding: 0 6px; background: var(--dark); border: 2px solid #000; justify-self: start; white-space: nowrap; }
body.touch .desk, body:not(.touch) .tch { display: none; }
.legend.tch li { grid-template-columns: 4.5em 1fr; }

/* touch controls */
#jump { display: none; }
body.touch #jump {
  display: block;
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  font-size: 34px;
  opacity: .85;
}
#paw { display: none; }
body.touch #paw {
  display: block;
  position: fixed;
  right: 112px;
  bottom: 22px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 26px;
  opacity: .85;
}
#stick {
  position: fixed;
  left: -55px;
  top: -55px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid #fff6;
  background: #0003;
  pointer-events: none;
}
#knob {
  position: absolute;
  left: 30px;
  top: 30px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fffa;
  border: 3px solid #000;
}

@media (max-width: 700px), (max-height: 500px) {
  #top { top: 6px; left: 6px; padding: 6px 10px; gap: 10px; font-size: 20px; }
  h1 { font-size: 10px; }
  #corner { top: 6px; right: 6px; }
  button { min-width: 40px; height: 40px; font-size: 18px; }
}
