/*
  STEADIE ARCADE: the system.

  The medium. One arcade cabinet standing in the dark by a pond at night. The screen is the only light
  in the room: the game is the picture, the page around it stays quiet. On the left the real jade
  figure of Steadie, on the right the score card of the cabinet.

  Colour. One ground (--ground, a near-black with a little green, never pure black), one ink (--ink, a
  warm off-white), and one accent: --accent, the jade of the frog. Amber, pink and red exist only inside
  the game's own pixels. --muted is for secondary text, --line for hairlines, --ground-2 for the bezel.
  One gradient on the page: the light the screen throws on the floor.

  Type. Three faces. --display is Jersey 10, a pixel face, for the name, the titles and every score.
  --body is Geist for sentences. --mono is Geist Mono for wallet addresses. Numbers are tabular.

  Shape. Two radii: 0 for everything that belongs to the pixel world (buttons, rows), --tube for the
  screen. No shadow glows, no glass, no cards. Spacing steps: 4 8 12 16 24 32 48.

  Motion. The game moves. The page does not.
*/

@font-face {
  font-family: 'Jersey 10';
  src: url('fonts/Jersey10-Regular.ttf') format('truetype');
  font-display: block;
}

:root {
  --ground: #060a08;
  --ground-2: #0c120f;
  --ink: #e9f0dc;
  --ink-2: #b7c2ae;
  --muted: #7b897d;
  --line: #1d2821;
  --accent: #a6e85a;
  --accent-ink: #071006;
  --display: 'Jersey 10', ui-monospace, monospace;
  --body: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --tube: 14px;
  --bar: 56px;
  --screen-h: min(calc(100svh - 148px), 880px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

/* ---- the bar */

.bar {
  height: var(--bar);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mark {
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
}

.bar nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.quiet {
  font: 500 13px/1 var(--body);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: none;
}

.quiet:hover,
.quiet:focus-visible {
  color: var(--ink);
}

/* ---- the floor: figure, cabinet, score card */

.floor {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 8px 32px 24px;
}

.cabinet {
  position: relative;
  display: grid;
  place-items: center;
  cursor: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* the light the screen throws on the floor: the page's one gradient */
.cabinet::before {
  content: '';
  position: absolute;
  inset: -12% -70%;
  background: radial-gradient(closest-side, rgba(166, 232, 90, 0.085), rgba(166, 232, 90, 0) 100%);
  pointer-events: none;
}

.screen {
  position: relative;
  height: var(--screen-h);
  aspect-ratio: 9 / 16;
  border-radius: var(--tube);
  overflow: hidden;
  background: #020403;
  outline: 1px solid var(--line);
  outline-offset: 10px;
  box-shadow: 0 0 0 10px var(--ground-2);
}

.screen canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#glow {
  filter: blur(calc(var(--px, 2px) * 5)) brightness(1.15);
  opacity: 0.42;
  mix-blend-mode: screen;
  pointer-events: none;
}

.crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) calc(var(--px, 2px) * 0.6), rgba(0, 0, 0, 0.24) calc(var(--px, 2px) * 0.6), rgba(0, 0, 0, 0.24) var(--px, 2px));
  box-shadow: inset 0 0 calc(var(--px, 2px) * 34) rgba(0, 0, 0, 0.6);
  border-radius: var(--tube);
}

/* ---- game over: the choice to save */

.over {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  text-align: center;
  cursor: default;
  font-family: var(--display);
  text-transform: uppercase;
}

.over[hidden] {
  display: none;
}

.over-line {
  margin: 0 0 16px;
  font-size: calc(var(--px, 2px) * 10);
  line-height: 1.05;
  color: var(--ink);
  min-height: 1.05em;
}

.over-actions,
.over-wallets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.over-wallets[hidden],
.over-actions[hidden] {
  display: none;
}

.btn {
  font-family: var(--display);
  font-size: calc(var(--px, 2px) * 10);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: rgba(6, 10, 8, 0.8);
  border: max(2px, calc(var(--px, 2px) * 1)) solid var(--ink);
  border-radius: 0;
  padding: calc(var(--px, 2px) * 4) calc(var(--px, 2px) * 6);
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn:hover,
.btn:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--accent-ink);
  outline: none;
}

.btn[hidden] {
  display: none;
}

.over-note {
  margin: 12px 0 0;
  font: 500 13px/1.4 var(--body);
  text-transform: none;
  color: var(--ink-2);
  min-height: 2.8em;
}

/* ---- the figure */

.about {
  justify-self: end;
  max-width: 340px;
}

.portrait {
  display: block;
  width: 232px;
  height: 232px;
  margin: 0 0 8px -24px;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle at 50% 52%, #000 50%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 52%, #000 50%, transparent 71%);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 68px;
  line-height: 0.86;
  letter-spacing: -0.01em;
}

h1 span {
  color: var(--accent);
}

.lede {
  margin: 16px 0 24px;
  color: var(--ink-2);
  max-width: 30ch;
}

.how {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--line);
}

.how li {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
}

.how b {
  font: 400 30px/0.8 var(--display);
  color: var(--accent);
}

.finger {
  display: none;
}

.go {
  font: 500 14px/1 var(--body);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
}

.go:hover,
.go:focus-visible {
  color: var(--accent);
}

/* ---- the score card */

.board {
  justify-self: start;
  width: 100%;
  max-width: 340px;
}

h2 {
  margin: 0;
  font: 400 44px/0.9 var(--display);
}

.board-meta {
  margin: 8px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.scores {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  max-height: calc(var(--screen-h) - 190px);
  overflow: auto;
  scrollbar-width: none;
}

.scores li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 40px auto;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0 5px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.scores .rank {
  font: 400 22px/1 var(--display);
  color: var(--muted);
}

.scores .who {
  font: 400 13px/1 var(--mono);
  color: var(--ink-2);
  white-space: nowrap;
}

.scores .stage {
  font: 400 12px/1 var(--mono);
  color: var(--muted);
}

.scores .pts {
  font: 400 24px/1 var(--display);
  text-align: right;
}

.scores li:first-child .rank,
.scores li:first-child .pts {
  color: var(--accent);
}

.scores li.me .who {
  color: var(--accent);
}

.board-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 34ch;
}

/* ---- the foot */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 32px 16px;
  font-size: 12px;
  color: var(--muted);
}

/* ---- narrow screens: the cabinet first, then the scores, then the figure */

@media (max-width: 1040px) {
  :root {
    --bar: 44px;
    --screen-h: min(calc(100svh - 64px), calc((100vw - 44px) * 16 / 9));
  }
  .bar {
    padding: 0 16px;
  }
  .mark {
    font-size: 26px;
  }
  .floor {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    padding: 12px 16px 24px;
    justify-items: center;
  }
  .cabinet {
    order: 1;
  }
  .board {
    order: 2;
    justify-self: center;
    max-width: 420px;
  }
  .about {
    order: 3;
    justify-self: center;
    max-width: 420px;
  }
  .scores {
    max-height: none;
  }
  .cabinet::before {
    inset: -6% -20%;
  }
  .foot {
    flex-direction: column;
    padding: 12px 16px 20px;
  }
  .keys {
    display: none;
  }
}

@media (hover: none) {
  .mouse {
    display: none;
  }
  .finger {
    display: inline;
  }
  .keys {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #glow {
    display: none;
  }
}
