* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #8fd3ff;
  color: #1d1d1b;
}

#game canvas {
  display: block;
  touch-action: none;
}

.hud {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.hud-item {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(41, 42, 35, 0.85);
  color: #fffefa;
  font-size: 18px;
  font-weight: 700;
}

.startng-card {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: #292a23;
  color: #fffefa;
}

.startng-card[hidden] {
  display: none;
}

.startng-card img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #d8fd71;
}

.startng-card b {
  display: block;
  font-size: 16px;
}

.startng-card span {
  font-size: 12px;
  opacity: 0.7;
}

.startng-card button {
  margin-left: 8px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: #d8fd71;
  font-weight: 700;
  cursor: pointer;
}

.level-up {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 28px;
  border-radius: 999px;
  background: #7b2cbf;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  animation: level-up-pop 1.5s ease-out forwards;
}

.level-up[hidden] {
  display: none;
}

@keyframes level-up-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  15% { opacity: 1; transform: translateX(-50%) scale(1.1); }
  30% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 40, 70, 0.35);
}

.overlay[hidden] {
  display: none;
}

.panel {
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 24px;
  border-radius: 20px;
  background: #fffefa;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 40px;
  color: #7b2cbf;
}

.panel h2 {
  margin: 0 0 8px;
}

.panel h3 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.hint {
  font-size: 14px;
  opacity: 0.75;
}

.result {
  font-size: 20px;
}

#leaderboard {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  text-align: left;
}

#leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
}

#leaderboard li.me {
  background: #d8fd71;
  font-weight: 700;
}

.primary {
  border: 0;
  border-radius: 999px;
  padding: 12px 32px;
  background: #7b2cbf;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
