* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: 'Courier New', ui-monospace, Menlo, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#stage {
  position: relative;
  line-height: 0;
}
#game {
  display: block;
  width: 256px;
  height: 240px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
}
#toolbar {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  line-height: normal;
}
#toolbar[hidden] {
  display: none;
}
#toolbar button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  line-height: 1.4;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  overflow-y: auto;
}
.overlay[hidden] {
  display: none;
}
#title {
  background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.55));
}
h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 56px);
  letter-spacing: 4px;
  color: #d97757;
  text-shadow: 3px 3px 0 #000, -1px -1px 0 #fff3e6;
}
h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 36px);
  color: #fcd000;
  text-shadow: 2px 2px 0 #000;
}
.sub {
  margin: 0;
  font-size: clamp(12px, 1.8vw, 16px);
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.hint {
  margin: 0;
  font-size: 12px;
  color: #ddd;
  text-shadow: 1px 1px 0 #000;
}
.buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 200px;
}
.buttons button,
.buttons select,
.buttons input {
  font: inherit;
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 2px solid #000;
  background: #d97757;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 #000;
}
.buttons button:focus-visible,
.buttons select:focus-visible,
.buttons input:focus-visible {
  outline: 3px solid #fcd000;
  outline-offset: 2px;
}
.buttons button.secondary {
  background: #444;
}
.buttons button.alt {
  background: #1a9c2a;
}
.buttons button small {
  display: block;
  font-size: 11px;
  opacity: 0.9;
}
.buttons select,
.buttons input {
  background: #fff;
  color: #000;
  cursor: auto;
}
#select-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
#select-wrap[hidden] {
  display: none;
}
.help-list {
  margin: 0;
  padding: 0 0 0 18px;
  text-align: left;
  font-size: 13px;
  max-width: 460px;
}
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 4px;
  margin: 0 1px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #222;
  font-size: 11px;
  text-align: center;
}
.scores {
  font-size: 12px;
  min-width: 220px;
}
.scores[hidden] {
  display: none;
}
.scores h3 {
  margin: 4px 0;
  font-size: 13px;
  color: #fcd000;
}
.scores ol {
  margin: 0;
  padding-left: 24px;
  text-align: left;
}
#touch {
  display: none;
  width: 100%;
  justify-content: space-between;
  padding: 8px 16px 16px;
  line-height: normal;
}
#touch .pad {
  display: flex;
  gap: 10px;
}
#touch button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  touch-action: none;
}
#touch button.on {
  background: rgba(217, 119, 87, 0.7);
}
@media (pointer: coarse) {
  #touch {
    display: flex;
  }
}
