:root {
  color-scheme: dark;
  --bg: #11121a;
  --ink: #f1eadf;
  --muted: #8d8991;
  --line: rgba(241,234,223,.2);
  --page: clamp(18px, 3.5vw, 56px);
  --sans: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { color: inherit; font: inherit; }
a { color: inherit; text-decoration: none; }
.preview-header,
footer {
  display: flex;
  justify-content: space-between;
  padding: 19px var(--page);
  border-bottom: 1px solid var(--line);
  color: #aaa5ab;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .13em;
}
main { padding: clamp(58px, 7vw, 110px) var(--page) clamp(50px, 6vw, 92px); }
.intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  max-width: 1440px;
  margin: 0 auto clamp(32px, 4vw, 60px);
}
.intro p { margin: 0; }
.intro > div > p { margin-bottom: 14px; color: #8d8991; font-family: var(--mono); font-size: 8px; letter-spacing: .16em; }
.intro h1 { margin: 0; font-size: clamp(40px, 6vw, 86px); line-height: 1.02; letter-spacing: -.018em; font-weight: 520; }
.intro-note { padding-bottom: 4px; color: #aaa5ab; font-size: 11px; line-height: 1.75; text-align: right; }
.game-wrap { max-width: 1440px; margin: 0 auto; }
.game-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(241,234,223,.28);
  background: #e6b98d;
  box-shadow: 0 34px 100px rgba(0,0,0,.28);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
}
.hud {
  position: absolute;
  z-index: 4;
  top: 16px;
  right: 18px;
  left: 18px;
  display: flex;
  justify-content: space-between;
  color: rgba(255,255,255,.95);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .09em;
  text-shadow: 1px 1px 0 rgba(0,0,0,.5);
  pointer-events: none;
}
.hud strong { font: inherit; }
.start-screen {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(12,13,20,.4);
  color: #fff8ed;
  text-align: center;
  backdrop-filter: blur(2px);
  transition: opacity .4s ease, visibility .4s ease;
}
.game-shell[data-state="playing"] .start-screen { opacity: 0; visibility: hidden; pointer-events: none; }
.start-screen p { margin: 0 0 12px; font-family: var(--mono); font-size: 7px; letter-spacing: .19em; }
.start-screen h2 { margin: 0; font-size: clamp(27px, 4vw, 58px); line-height: 1; letter-spacing: -.05em; font-weight: 520; }
.start-screen span { margin-top: 17px; color: rgba(255,255,255,.78); font-size: 9px; line-height: 1.7; }
.start-screen button {
  margin-top: 24px;
  padding: 10px 17px;
  border: 1px solid rgba(255,255,255,.68);
  background: rgba(10,10,13,.22);
  color: #fff;
  cursor: pointer;
  font-size: 9px;
  letter-spacing: .1em;
}
.start-screen button:disabled { opacity: .5; cursor: wait; }
.toast {
  position: absolute;
  z-index: 6;
  top: 52px;
  left: 50%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(13,12,20,.74);
  color: #fff;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .09em;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.jump {
  position: absolute;
  z-index: 6;
  right: 18px;
  bottom: 18px;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 50%;
  background: rgba(12,13,20,.3);
  color: #fff;
  backdrop-filter: blur(6px);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .25s ease, transform .25s ease, background .15s ease;
}
.jump:active { background: rgba(255,255,255,.18); transform: scale(.94) !important; }
.jump span { display: block; margin-top: 2px; font-family: var(--sans); font-size: 7px; }
.game-shell[data-state="playing"] .jump { opacity: .92; transform: scale(1); }
.restart {
  position: absolute;
  z-index: 6;
  bottom: 22px;
  left: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.74);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .12em;
  opacity: 0;
  transition: opacity .25s ease;
}
.game-shell[data-state="playing"] .restart { opacity: 1; }
.instructions {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding-top: 13px;
  color: #79757d;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .08em;
}
.instructions p { margin: 0; font-family: var(--sans); letter-spacing: .03em; text-align: right; }
footer { border-top: 1px solid var(--line); border-bottom: 0; }

@media (max-width: 700px) {
  .preview-header a { max-width: 54%; text-align: right; }
  main { padding-right: 0; padding-left: 0; }
  .intro { grid-template-columns: 1fr; gap: 16px; margin-right: var(--page); margin-left: var(--page); }
  .intro-note { font-size: 10px; text-align: left; }
  .game-shell { border-right: 0; border-left: 0; }
  .hud { top: 9px; right: 10px; left: 10px; font-size: 6px; }
  .start-screen p { margin-bottom: 7px; font-size: 6px; }
  .start-screen h2 { font-size: clamp(23px, 7vw, 32px); }
  .start-screen span { margin-top: 9px; font-size: 7px; }
  .start-screen button { margin-top: 12px; padding: 7px 12px; font-size: 7px; }
  .toast { top: 31px; padding: 6px 8px; font-size: 6px; }
  .jump { right: 10px; bottom: 10px; width: 48px; height: 48px; font-size: 7px; }
  .restart { bottom: 13px; left: 10px; font-size: 6px; }
  .instructions { margin-right: var(--page); margin-left: var(--page); font-size: 6px; }
  .instructions p { max-width: 57%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
