/* The panel is set in VT323, and a canvas cannot fall back gracefully: it measures
   and draws whatever the font string resolves to. main.js waits for this to load
   before the first frame. */
@font-face {
  font-family: VT323;
  src: url("assets/fonts/vt323-latin.woff2") format("woff2");
  font-display: block;
}

/* Screenprint, not phosphor: the source material is black ink on white paper, so
   the page is the shop wall the sheet is pinned to. */
:root {
  --wall: #e7e2d8;
  --ink: #1a1a1a;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--wall);
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* The canvas already carries the viewport's proportions, so filling the window
   scales it without distorting it. `dvh` rather than `vh`: a phone's address bar
   slides away, and `vh` would size the game to a window it never actually has. */
main {
  display: block;
  width: 100vw;
  height: 100dvh;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  /* The board is tapped, so the browser must not treat a tap as a scroll, a
     double-tap zoom, or a text selection. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---- the options panel --------------------------------------------------
   The only HTML the game has. It sits over the canvas rather than beside it, so
   nothing about the board's own layout has to know it exists. */

.opts-open {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  gap: 4px;
  padding: 11px 10px;
  background: #ffffff;
  border: 1px solid #c6c0b2;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 22%);
  cursor: pointer;
}

.opts-open span {
  display: block;
  width: 19px;
  height: 2px;
  background: var(--ink);
}

.opts-open:hover { border-color: var(--ink); }
.opts-open.on { background: var(--ink); }
.opts-open.on span { background: #ffffff; }

.opts-panel {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px);
  z-index: 3;
  width: min(290px, calc(100vw - 28px));
  max-height: min(70dvh, 560px);
  overflow-y: auto;
  background: #f4f2ed;
  border: 1px solid #c6c0b2;
  box-shadow: 0 6px 22px rgb(0 0 0 / 26%);
}

.opts-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px 9px;
  border-bottom: 1px solid #c6c0b2;
}

.opts-panel h2 {
  margin: 0;
  font-family: VT323, ui-monospace, monospace;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.opts-close {
  padding: 0 5px;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  color: #54514a;
  background: none;
  border: 0;
  cursor: pointer;
}

.opts-close:hover { color: var(--ink); }
.opts-body { padding: 12px 13px 14px; }

.opts-body h3 {
  margin: 0 0 9px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #54514a;
}

.opts-body h3 + * { margin-top: 0; }
.opts-body > h3:not(:first-child) { margin-top: 17px; }

.opts-row {
  display: grid;
  grid-template-columns: 54px 1fr 30px;
  gap: 9px;
  align-items: center;
  margin-bottom: 7px;
}

/* The seed sits beside a button rather than a readout, so the row is cut for that. */
.opts-run { grid-template-columns: 54px 1fr auto; }

.opts-seed {
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 3px 6px;
  background: #fff;
  border: 1px solid var(--rule, #d4d0c8);
  border-radius: 3px;
  color: #1a1a1a;
}

.opts-row label { font-size: 12px; color: #54514a; }
.opts-row input { width: 100%; }

.opts-row output {
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #8a857a;
}

.opts-check {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 9px;
  font-size: 12px;
  color: #54514a;
}

.opts-check label { cursor: pointer; }

.opts-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.opts-track {
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #c6c0b2;
  border-radius: 3px;
  cursor: pointer;
}

.opts-track:hover { border-color: var(--ink); }

.opts-track.on {
  color: #ffffff;
  background: var(--ink);
  border-color: var(--ink);
}

.opts-note {
  margin: 11px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: #8a857a;
}
