:root {
  color-scheme: dark;
  font-family: "Press Start 2P", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #15181f;
  color: #f7ead1;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #15181f;
}

.app-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  container-type: size;
}

.game-shell {
  width: 100%;
  height: 100%;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #7fb36b;
}

.toolbar {
  position: absolute;
  right: 1.875cqw;
  bottom: 4.2cqh;
  z-index: 2;
}

.title-actions {
  position: absolute;
  left: 50%;
  bottom: 9.2cqh;
  z-index: 2;
  transform: translateX(-50%);
}

#start-run {
  min-width: 18cqw;
  min-height: 7cqh;
  border-color: #f7e06e;
  background: rgba(74, 104, 62, 0.92);
  box-shadow: 0 6px 0 rgba(21, 24, 31, 0.72);
}

#start-run:disabled {
  border-color: rgba(247, 234, 209, 0.4);
  color: rgba(247, 234, 209, 0.48);
  background: rgba(21, 24, 31, 0.62);
  cursor: default;
}

.high-score-panel {
  position: absolute;
  left: 50%;
  top: 66cqh;
  z-index: 4;
  width: min(52cqw, calc(100% - 8cqw));
  padding: clamp(8px, 1.25cqw, 12px);
  border: 3px solid #f7e06e;
  border-radius: 6px;
  background: rgba(21, 24, 31, 0.94);
  transform: translateX(-50%);
}

.game-over-actions {
  position: absolute;
  left: 50%;
  top: 76cqh;
  z-index: 4;
  transform: translateX(-50%);
}

.title-credit {
  position: absolute;
  left: 50%;
  bottom: 4.2cqh;
  z-index: 2;
  display: flex;
  gap: 0.65em;
  align-items: center;
  justify-content: center;
  width: 74cqw;
  color: rgba(247, 234, 209, 0.72);
  font-size: clamp(6px, 0.729cqw, 7px);
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
}

.title-credit a {
  color: rgba(247, 224, 110, 0.82);
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

#continue-title {
  min-width: 16cqw;
  min-height: 6.4cqh;
  border-color: #f7e06e;
  background: rgba(74, 104, 62, 0.92);
  box-shadow: 0 6px 0 rgba(21, 24, 31, 0.72);
}

.high-score-panel label {
  display: block;
  margin-bottom: 8px;
  color: #f7e06e;
  font-size: clamp(7px, 1.042cqw, 10px);
}

.score-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.score-entry-row input,
.parameter-row input {
  width: 100%;
  border: 2px solid rgba(247, 234, 209, 0.7);
  border-radius: 4px;
  padding: 7px 8px;
  background: rgba(21, 24, 31, 0.88);
  color: #f7ead1;
  font: clamp(7px, 1.042cqw, 10px)/1 "Press Start 2P", ui-monospace, monospace;
}

button {
  border: 2px solid #f7ead1;
  border-radius: 4px;
  padding: clamp(4px, 0.833cqw, 8px) clamp(5px, 1.042cqw, 10px);
  background: rgba(21, 24, 31, 0.9);
  color: #f7ead1;
  font: clamp(7px, 1.042cqw, 10px)/1 "Press Start 2P", ui-monospace, monospace;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #f7e06e;
  outline-offset: 2px;
}

.options-panel {
  position: absolute;
  top: 13.889cqh;
  right: 1.875cqw;
  z-index: 3;
  width: min(40.625cqw, calc(100% - 3.75cqw));
  max-height: calc(100% - 14.259cqh);
  overflow: auto;
  border: 3px solid #f7e06e;
  border-radius: 6px;
  padding: clamp(24px, 4.2cqw, 40px) clamp(8px, 1.25cqw, 12px) clamp(8px, 1.25cqw, 12px);
  background: rgba(21, 24, 31, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

.options-close {
  position: absolute;
  top: clamp(5px, 0.833cqw, 8px);
  right: clamp(5px, 0.833cqw, 8px);
  display: grid;
  place-items: center;
  width: clamp(24px, 3.333cqw, 32px);
  height: clamp(24px, 3.333cqw, 32px);
  padding: 0;
  border-color: rgba(247, 234, 209, 0.72);
}

.options-panel h2 {
  margin: 18px 0 10px;
  color: #f7e06e;
  font-size: 10px;
  font-weight: 400;
}

#options-toggle {
  display: grid;
  place-items: center;
  width: 3.542cqw;
  height: 6.296cqh;
  border-width: clamp(1px, 0.208cqw, 2px);
  border-color: rgba(247, 234, 209, 0.72);
  border-radius: clamp(2px, 0.417cqw, 4px);
  padding: 0;
  background: rgba(21, 24, 31, 0.68);
  color: transparent;
  font-size: 0;
  line-height: 1;
}

#options-toggle::before {
  content: "\2699";
  color: #f7ead1;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1.667cqw;
  line-height: 1;
  transform: translateY(-0.04em);
}

#options-toggle:hover {
  border-color: #f7e06e;
  background: rgba(21, 24, 31, 0.88);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: #f7e06e;
}

.controls-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.control-row {
  display: grid;
  grid-template-columns: 34px repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.control-row strong {
  color: #f7e06e;
  font-size: 9px;
}

.control-bind {
  min-height: 34px;
  padding: 5px 4px;
  font-size: 7px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.parameters-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.parameter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 9cqw);
  gap: 8px;
  align-items: center;
}

.parameter-row span {
  font-size: 7px;
  line-height: 1.35;
  color: #f7ead1;
}

.parameter-row input {
  min-height: 30px;
  padding: 5px 6px;
  font-size: 7px;
}