html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  overscroll-behavior: none;       /* ekkert "pull to refresh" á síma */
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  display: block;
  position: fixed;                 /* fyllir gluggann; main.js samstillir upplausnina */
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;              /* snertingar fara í leikinn, ekki skrun/aðdrátt */
  cursor: none;
  image-rendering: pixelated;
}

/* CRT-skannlínur og dökkir jaðrar yfir leiknum (16-bita útlit, K kveikir/slekkur) */
#crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
}

/* ---------- Valmynd (einn leikmaður / multiplayer) ---------- */
#menu {
  position: fixed;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  padding: 18px;
  background: rgba(10, 10, 12, 0.88);
  border: 1px solid #3a3a40;
  font: 14px monospace;
  color: #ddd;
  cursor: default;
}
#menu[hidden], #menu [hidden] { display: none; }
#menu h2 { margin: 0 0 12px; font-size: 13px; color: #c0392b; letter-spacing: 1px; }
#menu button, #menu input {
  font: bold 14px monospace;
  padding: 10px 12px;
  border: 1px solid #555;
  background: #1c1c20;
  color: #eee;
}
#menu button { display: block; width: 100%; margin-bottom: 8px; cursor: pointer; text-align: left; }
#menu button:hover:not(:disabled) { border-color: #f1c40f; color: #f1c40f; }
#menu button:disabled, #menu input:disabled { opacity: 0.4; cursor: not-allowed; }
#menu #btn-single { border-color: #c0392b; }
#menu .join { display: flex; gap: 6px; }
#menu .join input { width: 90px; text-transform: uppercase; letter-spacing: 2px; }
#menu .join button { margin: 0; text-align: center; }
#menu .sep { margin: 12px 0 8px; font-size: 11px; color: #777; }
#menu-status { min-height: 1.4em; margin-top: 10px; color: #f1c40f; line-height: 1.4; white-space: pre-line; }
#ios-hint { margin-top: 8px; font-size: 11px; color: #888; line-height: 1.4; }
#menu #btn-start { border-color: #2ecc71; color: #2ecc71; }

@media (max-width: 900px) and (min-height: 561px) {
  #menu { right: 50%; top: auto; bottom: 16px; transform: translateX(50%); }
}
/* Sími á hlið: valmyndin hægra megin, þéttari, og má skruna ef hún er of há */
@media (max-height: 560px) {
  #menu { right: 12px; width: 250px; padding: 10px 12px; max-height: calc(100vh - 24px); overflow-y: auto; font-size: 12px; }
  #menu h2 { margin-bottom: 6px; }
  #menu button, #menu input { padding: 7px 10px; font-size: 13px; }
  #menu button { margin-bottom: 5px; }
  #menu .sep { margin: 6px 0 4px; }
  #menu-status { margin-top: 4px; }
}

/* ---------- Topplisti ---------- */
#board {
  position: fixed;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  background: rgba(10, 10, 12, 0.92);
  border: 1px solid #3a3a40;
  font: 13px monospace;
  color: #ddd;
  cursor: default;
}
#board[hidden], #board [hidden] { display: none; }
#board h2 { margin: 0 0 8px; font-size: 14px; color: #f1c40f; letter-spacing: 1px; }
#board-score { font-size: 15px; font-weight: bold; color: #eee; margin-bottom: 8px; }
#board-form { display: flex; gap: 6px; margin: 8px 0; }
#board-form input, #board-form button, #board-close {
  font: bold 14px monospace; padding: 8px 10px; border: 1px solid #555; background: #1c1c20; color: #eee;
}
#board-form input { flex: 1; min-width: 0; border-color: #f1c40f; }
#board-form button, #board-close { cursor: pointer; }
#board-form button:hover, #board-close:hover { border-color: #f1c40f; color: #f1c40f; }
#board-msg { min-height: 1.3em; margin-bottom: 6px; line-height: 1.4; }
#board-list { list-style: none; margin: 0 0 10px; padding: 0; overflow-y: auto; flex: 1; }
#board-list li { display: flex; gap: 8px; padding: 3px 4px; border-bottom: 1px solid #222; }
#board-list li.me { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
#board-list .rank { width: 3.5em; color: #888; text-align: right; }
#board-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board-list .score { color: #f1c40f; font-weight: bold; }
#board-list .tag { font-size: 10px; color: #3fa9f5; }

@media (max-width: 900px) and (min-height: 561px) {
  #board { left: 50%; top: 16px; transform: translateX(-50%); max-height: 45vh; }
}
@media (max-height: 560px) {
  #board { left: 12px; width: 260px; padding: 10px 12px; max-height: calc(100vh - 24px); }
  #board-form input, #board-form button, #board-close { padding: 6px 8px; font-size: 13px; }
}
