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

html, body {
  height: 100%;
  overflow: hidden;
  background: #07131d;
  font-family: "Segoe UI", -apple-system, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#stage { position: fixed; inset: 0; }
#game {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 56%, rgba(2, 6, 12, 0.68) 100%);
}

#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  color: #e9fbff;
}

.hud-box { min-width: 86px; }
.hud-box.right { margin-left: auto; text-align: right; }
.hud-label {
  font-size: 10px;
  letter-spacing: 3px;
  opacity: 0.58;
  text-transform: uppercase;
}
.hud-value {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(79, 232, 216, 0.36);
  line-height: 1.1;
}
.hud-chip {
  margin: 0 auto;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #c8fffb;
  background: rgba(79, 232, 216, 0.08);
  border: 1px solid rgba(79, 232, 216, 0.22);
}

#btn-mute, .hud-home {
  pointer-events: auto;
  width: 36px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
#btn-mute:hover, .hud-home:hover { background: rgba(255, 255, 255, 0.14); }
#btn-mute.off { opacity: 0.45; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 9, 15, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
  z-index: 10;
}
.overlay.show { opacity: 1; visibility: visible; }

.panel {
  width: min(400px, 100%);
  padding: 34px 28px 28px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(12, 28, 39, 0.94), rgba(6, 16, 24, 0.94));
  border: 1px solid rgba(79, 232, 216, 0.16);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.56);
  text-align: center;
  color: #e9fbff;
}

.logo {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(100deg, #d8fff8, #61f3ff 52%, #4fe8d8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 18px rgba(79, 232, 216, 0.28));
}
.logo span { -webkit-text-fill-color: #ffe084; }

.tagline {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 5px;
  color: #98c8d2;
  text-transform: uppercase;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #04222b;
  cursor: pointer;
  background: linear-gradient(120deg, #a7fff3, #4fe8d8);
  box-shadow: 0 12px 30px rgba(79, 232, 216, 0.24);
}
.btn-hero {
  margin: 24px auto 20px;
  width: 78%;
  padding: 18px;
  font-size: 20px;
}

.howto.slim {
  list-style: none;
  display: grid;
  gap: 9px;
  margin: 0 0 18px;
}
.howto.slim li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #c9e6eb;
}
.howto.slim li i { font-style: normal; font-size: 18px; }
.howto.slim li b { color: #fff; }

.meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
}
.text-link { color: #92f4ea; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.meta-dot { opacity: 0.4; }

.over-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: #d7fffb;
}
.record-badge {
  display: none;
  margin: 12px auto 0;
  width: fit-content;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #073238;
  background: linear-gradient(100deg, #ffe084, #7cfaf0);
}
.record-badge.show { display: block; }

.final-score {
  margin: 10px 0 16px;
  font-size: 58px;
  font-weight: 900;
  color: #dffffa;
  text-shadow: 0 6px 26px rgba(79, 232, 216, 0.28);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.stat {
  flex: 1;
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.stat-v { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-k { font-size: 10px; color: #95c6cf; margin-top: 2px; letter-spacing: 1px; text-transform: uppercase; }

.submit-row { display: flex; gap: 10px; margin-bottom: 10px; }
.text-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  outline: none;
}
.btn-secondary {
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: rgba(79, 232, 216, 0.16);
  color: #dffffa;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.submit-status {
  min-height: 18px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #9efcf2;
}

.leaderboard-card {
  margin: 12px 0 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}
.card-title {
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: 3px;
  color: #d6ffff;
  opacity: 0.72;
}
.board-list { display: grid; gap: 8px; min-height: 72px; }
.board-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(4, 14, 20, 0.44);
  color: #edfefe;
  font-size: 13px;
}
.board-rank { font-weight: 800; color: #ffe084; }
.board-score { font-weight: 900; font-variant-numeric: tabular-nums; }
.board-meta { font-size: 11px; color: #8dbac2; }
.board-empty { padding: 12px 0; color: #8dbac2; font-size: 13px; }

@media (max-width: 560px) {
  .panel { padding: 26px 18px 20px; }
  .logo { font-size: 34px; }
  .submit-row { flex-direction: column; }
  .hud-box { min-width: 70px; }
}
