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

html, body {
  height: 100%;
  overflow: hidden;
  background: #14110f;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #241d18 0%, #14110f 70%);
}

canvas {
  display: block;
  touch-action: none;
  border-radius: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

@media (min-aspect-ratio: 480/800) {
  canvas { border-radius: 14px; }
}

/* Rangliste: Overlay, das nur nach einer Runde erscheint */
#lb {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 17, 15, .55);
  backdrop-filter: blur(3px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 20px;
}
#lb.hidden { display: none; }
.lbCard {
  width: 100%; max-width: 360px;
  background: #fffdf8; border: 1px solid #e7d9c2; border-radius: 18px;
  padding: 22px 20px 18px; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.lbCard h2 { margin: 0 0 6px; font-size: 19px; color: #3a2a1c; }
.lbSub { margin: 0 0 14px; font-size: 13px; color: #7a6a58; }
#lbName {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 2px solid #e7d9c2; border-radius: 12px; background: #fff;
  color: #2c2118; text-align: center; outline: none;
}
#lbName:focus { border-color: #2f7d63; }
#lbSave {
  width: 100%; margin-top: 12px; padding: 13px 16px;
  font-size: 16px; font-weight: 700; color: #fffdf8;
  background: #2f7d63; border: 0; border-radius: 12px; cursor: pointer;
}
#lbSave:disabled { opacity: .6; }
.ghost {
  margin-top: 8px; width: 100%; padding: 10px;
  background: none; border: 0; color: #7a6a58; font-size: 14px; cursor: pointer;
}
.lbResult { margin-top: 12px; font-size: 15px; font-weight: 600; color: #2f7d63; min-height: 20px; }
.lbResult.bad { color: #b4573a; }

#boardList { list-style: none; margin: 0 0 12px; padding: 0; text-align: left; }
#boardList li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 4px; border-bottom: 1px solid #f0e6d5;
  font-size: 15px; color: #3a2a1c;
}
#boardList li:last-child { border-bottom: 0; }
#boardList .rk { color: #7a6a58; width: 26px; }
#boardList .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#boardList .sc { font-weight: 700; color: #2f7d63; }
#boardList li.me .nm { font-weight: 700; }
#boardClose {
  width: 100%; padding: 13px 16px; font-size: 16px; font-weight: 700;
  color: #fffdf8; background: #2f7d63; border: 0; border-radius: 12px; cursor: pointer;
}

.lbLabel {
  display: block; text-align: left; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #8b7a66;
  margin: 0 2px 6px;
}

#lbBoard { text-align: center; }
.rankList { list-style: none; margin: 0 0 14px; padding: 0; text-align: left; max-height: 46vh; overflow-y: auto; }
.rankList li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 6px; border-bottom: 1px solid #f0e6d5;
  font-size: 15px; color: #3a2a1c;
}
.rankList li:last-child { border-bottom: 0; }
.rankList .rk { width: 26px; color: #8b7a66; font-variant-numeric: tabular-nums; }
.rankList .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankList .sc { font-weight: 700; color: #2f7d63; font-variant-numeric: tabular-nums; }
.rankList li.me { background: #eef6f1; border-radius: 8px; }
.rankList li.me .nm { font-weight: 700; }
.rankList li.sep { margin-top: 6px; border-top: 2px solid #e7d9c2; }
#lbAgain {
  width: 100%; padding: 13px 16px; font-size: 16px; font-weight: 700;
  color: #fffdf8; background: #2f7d63; border: 0; border-radius: 12px; cursor: pointer;
}
#lbForm.hidden, #lbBoard.hidden { display: none; }
