:root {
  color-scheme: dark;
  color: #f1e9dc;
  background: #1f1d1a;
  font: 15px/1.45 system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  margin: 0;
  padding: 18px 16px;
}

main { width: min(var(--window-width, 960px), 100%, max(250px, calc((100dvh - 111px) * 4 / 3))); }
main.compact { --window-width: 640px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

h1, h2 { line-height: 1.08; }
h1 { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2.25rem); letter-spacing: -0.048em; }
h2 { margin: 0 0 17px; font-size: 1.47rem; letter-spacing: -0.025em; }

button {
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid #736451;
  border-radius: 4px;
  background: #383129;
  color: inherit;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { background: #473a2e; }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid #f4bb8c; outline-offset: 3px; }

#stage {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #17191d;
  box-shadow: 0 0 0 1px #6f5e4d, 0 13px 34px #120e0a54;
}

#stage:fullscreen { width: 100%; height: 100%; box-shadow: none; }
#stage:-webkit-full-screen { width: 100%; height: 100%; box-shadow: none; }

#game {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
}

#game.active { cursor: url("./cursor.png") 3 3, default; }
#game:focus-visible { outline: 1px solid #d8a072; outline-offset: -2px; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: #231e19;
  text-align: center;
  padding: 20px;
}

.overlay p { margin: 0; }
dialog {
  width: min(360px, calc(100% - 32px));
  padding: 22px;
  border: 1px solid #bd886a;
  border-radius: 4px;
  color: #f1e9dc;
  background: #2e2520;
  box-shadow: 0 10px 34px #0e0908a6;
}

dialog::backdrop { background: #14110fc4; }
.settings { display: grid; gap: 6px; }
.speed-label { display: flex; justify-content: space-between; gap: 12px; }
output { color: #f4c0a0; font-variant-numeric: tabular-nums; }
input { margin: 0; accent-color: #dba282; }
.speed-marks { display: flex; justify-content: space-between; color: #cab8aa; font-size: 0.78rem; }
.check { display: flex; align-items: center; gap: 8px; width: max-content; }
.check:first-of-type { margin-top: 8px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
#resume, #restart { color: #251913; background: #e7b195; border-color: #f1bfaa; }
#resume:hover, #restart:hover { background: #f3c5ab; }

.controls { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; color: #c7bdb0; font-size: 0.82rem; }
kbd { font: inherit; color: #eee0d1; }
button kbd { color: #d7bdab; font-size: 0.78em; margin-left: 4px; }
#browser-message { margin: 7px 0 0; color: #e4b69f; }
[hidden] { display: none !important; }
