html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 800px at 50% 20%, #24384a, #141d26);
}

canvas {
  display: block;
  height: min(100vh, 148vw);
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

/* ---------- Leaderboard overlay ---------- */
.lb-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 30, 0.45);
}

.lb-panel.hidden {
  display: none;
}

.lb-card {
  width: min(340px, 86vw);
  background: #f7ecca;
  border: 3px solid #c9b979;
  border-radius: 14px;
  padding: 18px 20px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #4a4a3a;
}

.lb-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
  text-align: center;
  color: #e2574c;
}

.lb-row {
  display: flex;
  gap: 8px;
}

.lb-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 15px;
  border: 2px solid #c9b979;
  border-radius: 8px;
  background: #fffdf6;
  color: #4a4a3a;
  outline: none;
}

.lb-row input:focus {
  border-color: #8a7a45;
}

.lb-row button {
  padding: 8px 16px;
  font-size: 15px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: #86c74b;
  color: #fff;
  cursor: pointer;
}

.lb-row button:hover {
  background: #74b33c;
}

.lb-list {
  margin: 12px 0 4px;
  padding: 0;
  list-style: none;
  max-height: 190px;
  overflow-y: auto;
  font-size: 14px;
}

.lb-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid #e5d9ae;
}

.lb-list li:last-child {
  border-bottom: none;
}

.lb-list .lb-empty {
  color: #8a7a45;
  border-bottom: none;
  text-align: center;
}

.lb-list .rank {
  width: 22px;
  text-align: right;
  color: #8a7a45;
  flex: none;
}

.lb-list .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-list .score {
  font-weight: bold;
  flex: none;
}

.lb-msg {
  min-height: 18px;
  margin: 4px 0 8px;
  text-align: center;
  font-size: 13px;
  color: #5a8a3a;
}

.lb-msg.err {
  color: #c0392b;
}

.lb-skip {
  display: block;
  width: 100%;
  padding: 7px;
  font-size: 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #8a7a45;
  cursor: pointer;
}

.lb-skip:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ---------- Site chrome (hosted on cheesedestroyer.com) ---------- */
/* Both are fixed so they stay out of the body grid and never shift the canvas. */
#back {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: max(20px, env(safe-area-inset-left, 0px));
  z-index: 20;
  padding: 8px;
  color: #7f93a5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-decoration: none;
}

#back:hover,
#back:focus-visible {
  color: #dceaf4;
}

#credit {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  color: #5f7183;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-align: center;
  pointer-events: none;
}
