:root {
  --ink: #0e0e10;
  --paper: #e9e9e1;
  --shell: #151517;
  --shell-2: #08080a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--shell-2);
  color: var(--paper);
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 0%, #1b1b1f 0%, #08080a 62%, #050506 100%);
  touch-action: none;
}

#back {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 5;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: #6e6e78;
  text-decoration: none;
  padding: 5px 9px;
  border: 1px solid #2a2a2e;
  background: rgba(8, 8, 10, 0.75);
  transition: color 140ms, border-color 140ms;
}

#back:hover,
#back:focus-visible {
  color: var(--paper);
  border-color: #6e6e78;
  outline: none;
}

@media (max-height: 560px) {
  #back { top: 4px; left: 6px; font-size: 10px; padding: 3px 6px; }
}

#stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px;
  max-width: 100%;
}

#frame {
  position: relative;
  line-height: 0;
  border: 2px solid #2a2a2e;
  border-radius: 3px;
  background: var(--ink);
  box-shadow:
    0 0 0 1px #000,
    0 18px 60px -18px rgba(0, 0, 0, 0.95),
    0 0 90px -30px rgba(233, 233, 225, 0.18);
}

#screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--ink);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms linear;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.16) 0px,
      rgba(0, 0, 0, 0.16) 1px,
      rgba(0, 0, 0, 0) 1px,
      rgba(0, 0, 0, 0) 3px
    ),
    radial-gradient(130% 110% at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.42) 100%);
  mix-blend-mode: multiply;
}

#crt.on { opacity: 1; }

#hint, #legal {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.75;
  letter-spacing: 0.02em;
  text-align: center;
  color: #6e6e78;
  max-width: 62ch;
}

#hint b { color: #cfcfd6; font-weight: 600; }
#legal { color: #6a6a73; font-size: 11.5px; }
#legal b { color: #8a8a94; }

.tap { display: none; }
@media (pointer: coarse) {
  .tap { display: block; }
  #hint { font-size: 11.5px; }
}

#rotate {
  display: none;
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: #8a8a94;
  text-align: center;
}

@media (pointer: coarse) and (orientation: portrait) and (max-width: 820px) {
  #rotate { display: block; }
}

.noscript-note {
  color: #eee;
  font-family: ui-monospace, monospace;
  padding: 2rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-height: 560px) {
  #hint, #legal { display: none; }
  #stage { gap: 0; padding: 4px; }
}
