body { background: black; text-align: center; }
/* the box hugs the meme (no letterboxing), so the buttons sit right under the Brian on any screen,
   including tall ones like a phone in desktop mode */
img { width: min(100%, 500px); height: auto; max-height: 70vh; object-fit: contain; display: block; margin: 0 auto 10px; }
img[hidden] { display: none; }
#msg { color: white; }
#maker { color: white; font-family: sans-serif; max-width: 500px; margin: 0 auto; }
#maker input { width: 100%; box-sizing: border-box; font-size: 1.1em; padding: 6px; margin: 4px 0 12px; text-transform: uppercase; }
#maker label { display: block; text-align: left; }
a { color: white; }
#topbar { position: absolute; top: 6px; right: 12px; font: 13px/18px sans-serif; }
#topbar a { color: #666; text-decoration: none; }
#topbar a:hover { color: #aaa; text-decoration: underline; }
/* the "LOADING..." Brian (same box as the meme) until the first meme arrives; its width/height
   attributes reserve the space before loading.jpg itself is in, so the buttons don't jump */
#loading { color: #666; font: 15px sans-serif; }
/* "Give me a random…" stays dead centre whether or not Download/Report (different widths) are showing */
#row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; max-width: 520px; margin: 0 auto; }
#row #dl { grid-column: 1; grid-row: 1; justify-self: end; }
#row #go { grid-column: 2; grid-row: 1; }
#row #rep { grid-column: 3; grid-row: 1; justify-self: start; }
/* keep their space while hidden, so nothing moves when they appear after the first load */
#row button[hidden] { display: block; visibility: hidden; }
/* phones: one tidy block, every button lined up in the same two columns:
   [   Give me a random Bad Luck Brian   ]
   [      Download     ][     Report     ]
   [ Make a Bad Luck B ][   Scroll mode  ]
   [   Gambling mode   ][Finish the Brian] */
@media (max-width: 440px) {
  #row, #more { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 340px; margin-left: auto; margin-right: auto; }
  #row #go { grid-column: 1 / -1; grid-row: 1; justify-self: stretch; }
  #row #dl { grid-column: 1; grid-row: 2; justify-self: stretch; }
  #row #rep { grid-column: 2; grid-row: 2; justify-self: stretch; }
  #more { margin-top: 6px; }
  #row button, #more button { padding: 8px 4px; }
}
/* dark buttons: the browser's default white ones glared on the black page, especially on phones */
button { background: #222; color: #ddd; border: 1px solid #444; border-radius: 6px; padding: 5px 10px; font: 14px sans-serif; cursor: pointer; }
button:hover { background: #2e2e2e; color: #fff; border-color: #555; }
button:active { background: #3a3a3a; }
button:disabled { color: #777; cursor: default; }
