* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #cfd;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#wrap {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
}

canvas#game {
  display: block; background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  box-shadow: 0 0 0 2px #1a3, 0 0 24px #0f06;
}

#touch {
  position: fixed; inset: 0; z-index: 5;
  touch-action: none; background: transparent;
}

#hud {
  position: fixed; top: 8px; left: 8px; right: 8px; z-index: 10;
  display: flex; justify-content: space-between; gap: 6px;
  font-size: 11px; letter-spacing: 1px;
  text-shadow: 0 0 6px #0f08;
  pointer-events: none; flex-wrap: wrap;
}
#hud span {
  background: rgba(0,30,10,.75);
  padding: 3px 7px; border: 1px solid #1a3; border-radius: 2px;
}
#pts {
  pointer-events: auto; cursor: pointer;
}
#pts:hover { border-color: #4de; color: #4de; }

#msg {
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  text-align: center; font-size: 22px; letter-spacing: 2px;
  color: #cfd; text-shadow: 0 0 8px #0f0a;
  background: rgba(0,0,0,.55); pointer-events: none; padding: 16px;
}
#msg.show { display: flex; }
#msg .sub { font-size: 12px; letter-spacing: 1px; opacity: .75; }
#msg .blurb { font-size: 13px; letter-spacing: .5px; opacity: .85; line-height: 1.8; }

/* Leaderboard overlay */
#lb {
  position: fixed; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.78);
  padding: 16px;
}
#lb.show { display: flex; }

#lb-inner {
  background: #07190e;
  border: 1px solid #2a7a45;
  border-radius: 4px;
  padding: 20px 24px;
  min-width: 280px; max-width: 380px; width: 100%;
  display: flex; flex-direction: column; gap: 14px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 0 30px #0f08;
}

#lb-title {
  font-size: 20px; letter-spacing: 3px; text-align: center;
  color: #ff5b3b; text-shadow: 0 0 8px #ff3;
}

#lb-score {
  text-align: center; font-size: 13px; letter-spacing: 1px; color: #9de;
}

#lb-form { display: flex; gap: 8px; }

#lb-name {
  flex: 1; background: #0a2010; color: #cfd;
  border: 1px solid #2a7a45; border-radius: 2px;
  padding: 7px 10px; font: inherit; font-size: 13px; letter-spacing: 1px;
  outline: none;
}
#lb-name:focus { border-color: #4de; }
#lb-name:disabled { opacity: .5; }

button {
  background: #0d3a1c; color: #cfd;
  border: 1px solid #2a7a45; border-radius: 2px;
  padding: 7px 14px; font: inherit; font-size: 12px;
  letter-spacing: 1px; cursor: pointer;
  transition: background .15s;
}
button:hover:not(:disabled) { background: #1a5c30; }
button:disabled { opacity: .45; cursor: default; }

#lb-rows {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; min-height: 20px;
}
.lb-row {
  display: flex; gap: 8px; align-items: baseline;
  padding: 3px 0; border-bottom: 1px solid #0f3020;
}
.lb-rank { color: #4a8; min-width: 18px; }
.lb-name-col { flex: 1; color: #cfd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { color: #ff9; min-width: 52px; text-align: right; }
.lb-lv { color: #7ae; min-width: 36px; text-align: right; }
.lb-empty { color: #567; font-size: 11px; text-align: center; padding: 8px 0; }

#lb-again {
  align-self: center; letter-spacing: 2px; font-size: 12px; padding: 9px 20px;
}

#ver {
  position: fixed; right: 6px; bottom: 6px; z-index: 10;
  font-size: 10px; letter-spacing: 1px; color: #4a6; opacity: .75;
  pointer-events: none;
}
