@font-face {
  font-family: Handjet;
  src: url(/fonts/handjet-latin-800-normal.woff2);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 5%, #28494c, #0e2022 75%);
  color: #f0f6f3;
  font:
    16px system-ui,
    sans-serif;
}
main {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 22px 16px;
}
header {
  margin-bottom: 18px;
}
header a {
  font:
    bold 32px Handjet,
    monospace;
  text-decoration: none;
  color: inherit;
}
header span {
  color: #ff7db2;
}
.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.bar button,
select {
  background: #172c30;
  color: #f0f6f3;
  border: 1px solid #739092;
  border-radius: 7px;
  padding: 8px;
  font:
    600 14px system-ui,
    sans-serif;
  cursor: pointer;
}
select {
  flex: 1;
  min-width: 94px;
}
#view[aria-pressed='true'] {
  background: #eaf0ec;
  color: #16272b;
}
#expand {
  color: inherit;
  font-size: 13px;
}
button:focus-visible,
select:focus-visible {
  outline: 3px solid #d82271;
  outline-offset: 2px;
  z-index: 1;
}
.stage {
  position: relative;
  perspective: 1050px;
  padding: 30px 17px 32px;
}
.game-display {
  display: none;
}
@media (min-width: 860px) {
  html:not(.embedded) main {
    width: min(100%, 1080px);
    padding-inline: 28px;
  }
  html:not(.embedded) .play-layout {
    display: grid;
    grid-template-columns: 386px minmax(0, 1fr);
    gap: clamp(20px, 4vw, 58px);
    align-items: start;
  }
  html:not(.embedded) .device[data-angled] {
    transform: rotateZ(13deg) rotateX(var(--pitch)) rotateY(var(--yaw)) scale(0.91);
  }
  html:not(.embedded) .game-display {
    display: block;
    position: relative;
    margin-top: 64px;
    padding: 10px;
    background: #0b1719;
    border: 1px solid #325458;
    box-shadow: 0 12px 26px #07111266;
  }
}
.device {
  --depth: 12.2cqw;
  --corner: 4.2cqw;
  --face-inset: 3.35cqw;
  --back-inset: 2.7cqw;
  --key-rise: 1.1cqw;
  position: relative;
  width: min(100%, 306px);
  margin: 0 auto;
  container-type: inline-size;
  transform-style: preserve-3d;
  transform: rotateZ(0deg) rotateX(0deg) rotateY(0deg);
  transition: transform 0.45s ease;
}
.device[data-angled] {
  transform: rotateZ(13deg) rotateX(var(--pitch)) rotateY(var(--yaw));
}
.shell {
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--depth) / 2));
}
.device[data-dragging] {
  transition: none;
}
#orbit:not([hidden]) {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}
#orbit:active {
  cursor: grabbing;
}
#orbit:focus-visible {
  outline: 2px solid #789692;
  outline-offset: -4px;
  border-radius: 16px;
}
#orbit-help {
  margin: 2px 0 8px;
  text-align: center;
  color: #cfdbd8;
  font-size: 13px;
}
.face {
  position: relative;
  backface-visibility: hidden;
  aspect-ratio: 82 / 160;
  transform-style: preserve-3d;
}
.face::before,
.case-edge,
.case-back {
  position: absolute;
  pointer-events: none;
  backface-visibility: hidden;
}
.face::before {
  content: '';
  inset: var(--face-inset);
  border-radius: calc(var(--corner) - var(--face-inset));
  background: linear-gradient(105deg, #ededeb, #f9f9f7 8%, #f2f2ef 87%, #e2e1dd);
}
.case-back {
  inset: var(--back-inset);
  border-radius: calc(var(--corner) - var(--back-inset));
  background: linear-gradient(116deg, #f8f6ee 3%, #eeece4 60%, #e2ded3);
  box-shadow: inset 0 0 0 1px #faf8ef, inset 0 0 4px #9d95813b;
  transform: translateZ(calc(-1 * var(--depth))) rotateY(180deg);
}
.case-edge {
  top: 50%;
  left: 50%;
  width: var(--panel-width);
  height: calc(var(--panel-height) + 0.7px);
  background:
    linear-gradient(var(--panel-rear), var(--panel-front));
  background:
    linear-gradient(
      color-mix(in srgb, #6d6658 var(--panel-shade), transparent),
      color-mix(in srgb, #6d6658 var(--panel-shade), transparent)
    ),
    linear-gradient(var(--panel-rear), var(--panel-front));
  transform-origin: top center;
  transform: translateX(-50%) rotateZ(var(--panel-angle))
    translateY(var(--panel-offset)) translateZ(var(--panel-depth))
    rotateX(var(--panel-slope)) translateY(-0.35px);
}
.case-top,
.case-top-left,
.case-top-right {
  top: var(--corner);
}
.case-bottom,
.case-bottom-left,
.case-bottom-right {
  top: calc(100% - var(--corner));
}
.case-left,
.case-top-left,
.case-bottom-left {
  left: var(--corner);
}
.case-right,
.case-top-right,
.case-bottom-right {
  left: calc(100% - var(--corner));
}
.case-seam::before {
  content: '';
  position: absolute;
  top: 40%;
  width: 100%;
  height: max(0.5px, 0.18cqw);
  background: #a0988566;
  box-shadow: 0 -0.5px #faf8f0ad;
}
.case-notch::after {
  content: '';
  position: absolute;
  top: 12%;
  left: 47%;
  width: 2.7cqw;
  height: 58%;
  border-radius: 50%;
  background: linear-gradient(#bdb49d, #dfd8c9 68%, #ede8de);
  box-shadow: inset 0 0.5px 1px #8c837366;
}
.bezel {
  position: absolute;
  top: 5.35%;
  left: 9.9%;
  width: 80.2%;
  padding: 4.75cqw;
  border-radius: 4% / 5%;
  background: linear-gradient(180deg, #b4b4ae, #efefec 12%, #f9f9f7 94%, #fff);
  box-shadow:
    inset 0 3px 4px #46453f48,
    inset 0 -2px 2px #fffcf3;
}
.bezel:has(canvas:focus-visible) {
  outline: 2px solid #607f7e;
  outline-offset: 2px;
}
canvas:focus-visible {
  outline: none;
}
canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  background: #0a1011;
  border: 1px solid #1b1b1b;
  box-shadow: 0 0 0 1px #625d52, 0 2px 5px #5a524491;
  image-rendering: pixelated;
}
#keys {
  transform-style: preserve-3d;
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#keys button {
  pointer-events: auto;
  position: relative;
  min-width: 0;
  padding: 0;
  height: var(--key-height, 100%);
  border: 1px solid #b7b2a6;
  border-radius: 999px;
  transform: translateZ(var(--key-rise));
  background: linear-gradient(150deg, #fcfcfa 8%, #f0f0ed 62%, #e5e4df 100%);
  box-shadow:
    inset 0 1px 1px #fff,
    0 1px 0 #d0c7b8,
    0 2px 0 #c6beae,
    0 3px 0 #b6ad9d,
    0 4px 3px #403a354c;
  color: #202426;
  font:
    600 clamp(9px, 4cqw, 15px) system-ui,
    sans-serif;
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
#keys button[data-down] {
  transform: translateZ(0);
  translate: 0 1px;
  box-shadow: inset 0 2px 3px #2b292678;
  filter: brightness(0.9);
}
/* Layout measured in the front view and normalized to the case. */
.keys-navigation {
  transform-style: preserve-3d;
  position: absolute;
  inset: 0;
}
#keys .keys-navigation button {
  position: absolute;
  z-index: 1;
}
#keys .keys-navigation button:nth-child(-n + 4):not([data-down]) {
  border-color: transparent;
  background: none;
  box-shadow: none;
  transform: translateZ(calc(var(--key-rise) + 0.25px));
  font-size: 3.4cqw;
}
.keys-navigation [data-key='0'],
.keys-navigation [data-key='3'] {
  top: 44.22%;
  width: 11.14%;
  --key-height: 3.83%;
}
.keys-navigation [data-key='0'] {
  left: 10.26%;
}
.keys-navigation [data-key='3'] {
  left: 23.97%;
}
.keys-navigation [data-key='1'],
.keys-navigation [data-key='2'] {
  left: 18.75%;
  width: 7.52%;
  --key-height: 5.68%;
}
.keys-navigation [data-key='1'] {
  top: 39.82%;
}
.keys-navigation [data-key='2'] {
  top: 46.76%;
}
.keys-navigation [data-key='4'],
.keys-navigation [data-key='5'] {
  top: 43.38%;
  width: 11.05%;
  --key-height: 5.63%;
}
.keys-navigation [data-key='4'] {
  left: 65.03%;
}
.keys-navigation [data-key='5'] {
  left: 78.76%;
}
.keys-navigation [data-key='6'],
.keys-navigation [data-key='8'] {
  left: 43.18%;
  width: 13.54%;
  --key-height: 4.41%;
}
#keys [data-key='6'] {
  top: 40.9%;
  background: linear-gradient(#fac65b, #e9a018);
  font-size: 0;
}
#keys [data-key='6']::after {
  content: '';
  position: absolute;
  inset: 17% 32%;
  background: #fffdf3;
  clip-path: polygon(
    50% 4%, 98% 44%, 98% 96%, 60% 96%, 60% 66%, 40% 66%, 40% 96%,
    2% 96%, 2% 44%, 50% 4%, 50% 20%, 14% 49%, 14% 84%, 28% 84%,
    28% 54%, 72% 54%, 72% 84%, 86% 84%, 86% 49%, 50% 20%
  );
}
#keys [data-key='8'] {
  top: 47.12%;
  background: linear-gradient(#2d2e2b, #141513);
  color: #fff;
}
.keys-navigation::before,
.keys-navigation::after {
  content: '';
  position: absolute;
  border: 1px solid #b5b1a4;
  border-radius: 999px;
  background: linear-gradient(#fdfbf6, #e8e5da);
  box-shadow: 0 2px 1px #b6b1a3;
}
.keys-navigation::before {
  left: 18.75%;
  top: 39.82%;
  width: 7.52%;
  height: 12.62%;
}
.keys-navigation::after {
  left: 10.26%;
  top: 44.22%;
  width: 24.85%;
  height: 3.83%;
}
@supports (clip-path: shape(from 0 0, line to 100% 100%, close)) {
  .keys-navigation::before,
  .keys-navigation::after {
    left: 10.26%;
    top: 39.82%;
    width: 24.85%;
    height: 12.62%;
    border: 0;
    border-radius: 0;
    clip-path: shape(
      from 35% 34%,
      line to 35% 15%,
      curve to 65% 15% with 35% -5% / 65% -5%,
      line to 65% 34%,
      line to 85% 34%,
      curve to 85% 65% with 105% 34% / 105% 65%,
      line to 65% 65%,
      line to 65% 85%,
      curve to 35% 85% with 65% 105% / 35% 105%,
      line to 35% 65%,
      line to 15% 65%,
      curve to 15% 34% with -5% 65% / -5% 34%,
      close
    );
  }
  .keys-navigation::before {
    background: #aaa597;
    transform: translateY(1.5px);
  }
  .keys-navigation::after {
    background: linear-gradient(150deg, #fffefa, #e0dccf);
    transform: translateZ(var(--key-rise)) scale(0.98);
  }
}
.keys-functions,
.keys-numbers {
  transform-style: preserve-3d;
  position: absolute;
  display: grid;
  left: 10.18%;
  width: 79.65%;
}
.keys-functions {
  top: 54.68%;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 7.52cqw;
  gap: 3.5cqw 2.58cqw;
}
.keys-numbers {
  top: 71.49%;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 8.66cqw;
  gap: 3.62cqw 3cqw;
}
#keys .keys-functions button {
  font-size: clamp(8px, 3.6cqw, 12px);
}
#keys .has-legends {
  padding-top: 2cqw;
}
.shift-legend,
.alpha-legend {
  position: absolute;
  top: 0;
  font-size: clamp(5px, 2.15cqw, 7px);
  font-weight: 650;
  line-height: 1.15;
}
.shift-legend {
  left: 15%;
  color: #865716;
}
.alpha-legend {
  right: 16%;
  color: #5d6263;
}
#status {
  margin: 0;
  font-size: 14px;
}
#status:empty {
  display: none;
}
footer {
  padding-top: 12px;
  font-size: 13px;
  line-height: 1.6;
}
footer a {
  color: inherit;
}
.embedded body {
  background: transparent;
}
.embedded main {
  margin: 0 auto;
  padding: 4px 14px;
}
.embedded header {
  display: none;
}
.embedded .stage {
  padding: 15px 10px 10px;
}
.embedded .device {
  width: min(100%, 270px);
}
.embedded footer {
  padding-top: 5px;
}
@media (max-width: 520px) {
  .device {
    width: min(88%, 306px);
  }
  .device[data-angled] {
    transform: rotateZ(6deg) rotateX(var(--pitch)) rotateY(var(--yaw)) scale(0.91);
  }
}
@media (prefers-reduced-motion: reduce) {
  .device {
    transition: none;
  }
}
body {
  min-height: 100vh;
}
.case-port::after {
  position: absolute;
  content: '';
  left: 45%;
  width: 10%;
  top: 18%;
  height: 64%;
  border: 1px solid #8c8474;
  border-radius: 999px;
  background: linear-gradient(#242321 35%, #8e887c 43%, #545047 61%, #222321 68%);
  box-shadow: 0 1px 0 #fdfaf0;
}
.preview .bar,
.preview footer {
  display: none;
}
.preview .stage {
  padding-top: 18px;
}
.preview .device {
  transition: none;
}
.scanlines .bezel::after,
.scanlines .game-display::after {
  content: '';
  position: absolute;
  inset: 4.75cqw;
  pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, #0a10111c 2px 3px);
}

.scanlines .game-display::after {
  inset: 10px;
}

.stage::before {
  content: '';
  position: absolute;
  pointer-events: none;
  bottom: 0;
  left: 15%;
  width: 70%;
  height: 9%;
  background: radial-gradient(ellipse, #07111282, transparent 70%);
}
.case-feet {
  position: absolute;
  inset: 1.2% 3.95% 2%;
  display: grid;
  grid-template: repeat(3, 1fr) / 1fr 1fr;
  align-items: center;
  justify-items: start;
}
.case-feet i {
  display: block;
  width: 7.65cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(146deg, #dad7cd, #e9e6dd 78%);
  box-shadow: inset 0 0 1px #b9b3a9, 0 1px 1px #faf7ed;
}
.case-feet i:nth-child(even) {
  justify-self: end;
}
.case-feet i:nth-child(-n + 2) {
  align-self: start;
}
.case-feet i:nth-last-child(-n + 2) {
  align-self: end;
}
.reset-recess {
  position: absolute;
  top: 39.65%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 0.65cqw;
  color: #99958a;
  font: 700 2cqw system-ui, sans-serif;
  text-shadow: 0 0.5px #fff;
}
.reset-recess::after {
  content: '';
  width: 1.5cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #a6a196;
  box-shadow: inset 0 1px 1px #736e62, 0 1px 1px #fff;
}

main:has(.device[data-orbiting]) footer {
  visibility: hidden;
}

/* ?screen=1 (player.mjs screenOnly): only the game screen, filling the frame, for the NumRise contest page. */
html.screen-only,
html.screen-only body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}
html.screen-only main {
  display: none;
}
.screen-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.screen-box {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}
.screen-box canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  outline: none;
  cursor: pointer;
}
.focus-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 9px 16px 8px;
  border: 0;
  background: #ebd24a;
  color: #0b1416;
  font: bold 15px system-ui, sans-serif;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  white-space: nowrap;
}
.screen-wrap[data-focused] .focus-hint {
  display: none;
}
.touch-pad {
  display: none;
}
@media (pointer: coarse) {
  .focus-hint {
    display: none;
  }
  .touch-pad {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    padding: 8px;
    background: #0b1a1c;
  }
  .touch-pad button {
    height: 58px;
    border: 0;
    border-radius: 8px;
    background: #27333a;
    color: #fff;
    font: bold 22px system-ui, sans-serif;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .touch-pad button[data-down] {
    background: #f5609f;
    color: #14080e;
  }
}
