:root {
  --bg: #141a2e;
  --text: #fff6e8;
  --panel: #2c3a5e;
  --light: #5f77b0;
  --dark: #151c33;
  --gold: #f5b83a;
  --pixel: 'Press Start 2P', monospace;
  --body: 'VT323', monospace;
}

* { box-sizing: border-box; }

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

button { font: inherit; color: inherit; }

.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 {
  cursor: pointer;
  min-width: 44px;
  height: 44px;
  background: #3d5085;
  border: 3px solid #000;
  box-shadow: inset 3px 3px 0 #7d96d0, inset -3px -3px 0 #1d2748;
  padding: 0 8px;
  font-size: 22px;
  text-shadow: 2px 2px 0 #000;
  touch-action: manipulation;
}
button:active, button.on { box-shadow: inset -3px -3px 0 #7d96d0, inset 3px 3px 0 #1d2748; background: #2a3966; }
button.on { outline: 3px solid var(--gold); outline-offset: -6px; }
button:disabled { opacity: .4; cursor: default; }
button.go { background: #2f8a4c; box-shadow: inset 3px 3px 0 #6fd38d, inset -3px -3px 0 #164a27; }
button.go:active { box-shadow: inset -3px -3px 0 #6fd38d, inset 3px 3px 0 #164a27; }

#app { position: fixed; inset: 0; }

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
body.pan #view { cursor: grab; }
body.panning #view { cursor: grabbing; }
body.eraser #view { cursor: none; }

#top {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  pointer-events: none;
}
h1 { margin: 0; font: 13px/1.4 var(--pixel); color: var(--gold); }
#hud { display: none; gap: 12px; font-size: 24px; }
body.playing #hud { display: inline-flex; }
#speed { min-width: 4.5em; text-align: right; }

#bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  max-width: calc(100% - 20px);
}
.group { display: flex; gap: 4px; }
.sw { display: inline-block; width: 22px; height: 6px; border: 2px solid #000; vertical-align: middle; }
.sw.t0 { background: #f2efe6; }
.sw.t1 { background: #ff5d4f; }
.sw.t2 { background: #6f8fd6; }

/* while she rides, drawing is off */
body.playing #tools, body.playing #types, body.playing #undo, body.playing #redo, body.playing #clear { opacity: .35; pointer-events: none; }

#toast {
  position: absolute;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: #000c;
  border: 3px solid var(--gold);
  font-size: 22px;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 700px), (max-height: 500px) {
  h1 { font-size: 10px; }
  #top { top: 6px; left: 6px; padding: 6px 10px; gap: 10px; }
  #bar { bottom: 6px; gap: 6px; padding: 6px; }
  button { min-width: 38px; height: 38px; font-size: 18px; padding: 0 5px; }
  .group { gap: 3px; }
}
