:root {
  --bg: #000;
  --fg: #aaa;
  --hi: #55ffff;
  --pink: #ff55ff;
  --yellow: #ffff55;
  --blue: #0000aa;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
}

/* ---- game page ---------------------------------------------------------- */
body.play {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* The original 640x350 (or 320x200) picture was shown on a 4:3 monitor. */
#screen {
  display: block;
  width: min(100vw, calc((100dvh - 40px) * 4 / 3));
  aspect-ratio: 4 / 3;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  touch-action: none;
}

#help {
  margin: 8px 16px 0;
  font-size: 13px;
  text-align: center;
}
#help b { color: var(--hi); font-weight: normal; }
#help a { color: var(--pink); }

#touch { display: none; }

@media (pointer: coarse) {
  body.play { align-items: flex-start; }
  #help { display: none; }
  #screen { width: min(100vw, calc((100dvh - 190px) * 4 / 3)); }
  #touch {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 640px;
    padding: 12px 16px;
    user-select: none;
    -webkit-user-select: none;
  }
  #pad {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #111;
    border: 2px solid #0000aa;
    touch-action: none;
  }
  #pad span {
    position: absolute;
    width: 0;
    height: 0;
    border: 14px solid transparent;
  }
  #pad .u { left: 61px; top: 8px; border-bottom-color: var(--hi); }
  #pad .d { left: 61px; bottom: 8px; border-top-color: var(--hi); }
  #pad .l { top: 61px; left: 8px; border-right-color: var(--hi); }
  #pad .r { top: 61px; right: 8px; border-left-color: var(--hi); }
  #buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #buttons button {
    font: inherit;
    font-size: 15px;
    width: 76px;
    height: 56px;
    border-radius: 10px;
    border: 2px solid #555;
    background: #222;
    color: #fff;
    touch-action: none;
  }
  #buttons #btn-scan { background: #aa0000; border-color: #ff5555; }
  #buttons #btn-project { background: #aa5500; border-color: #ffff55; }
  #buttons #btn-menu, #buttons #btn-ok { height: 40px; font-size: 13px; }
}

/* ---- online saves ------------------------------------------------------- */
#help .who {
  font: inherit;
  color: var(--hi);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}
#help .who:hover, #help .who:focus-visible { color: var(--yellow); }
#account-note { color: var(--yellow); }
