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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #e8f1ff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(8, 14, 28, 0.55);
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
}

.hud-label {
  color: #6b8bbf;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.92) 70%);
  animation: fade 240ms ease-out;
}

.overlay.hidden {
  display: none;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel {
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.92), rgba(8, 14, 28, 0.92));
  border: 1px solid rgba(120, 180, 255, 0.35);
  border-radius: 14px;
  padding: 32px 36px;
  max-width: 420px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 30, 80, 0.5);
}

h1 {
  font-size: 32px;
  letter-spacing: 0.24em;
  margin-bottom: 6px;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(110, 180, 255, 0.55);
}

h2 {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b8bbf;
  margin-bottom: 8px;
}

.tagline {
  color: #b6c8e6;
  font-size: 15px;
  margin-bottom: 18px;
}

.controls-hint {
  margin: 14px 0 22px;
  font-size: 14px;
  color: #b6c8e6;
  line-height: 1.6;
}

.touch-hint {
  font-size: 12px;
  color: #6b8bbf;
  margin-top: 4px;
}

kbd {
  display: inline-block;
  padding: 3px 9px;
  margin: 0 2px;
  background: rgba(120, 180, 255, 0.12);
  border: 1px solid rgba(120, 180, 255, 0.4);
  border-radius: 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  color: #e8f1ff;
}

button {
  background: linear-gradient(180deg, #4a8fff, #2862c8);
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(40, 98, 200, 0.4);
  transition: transform 80ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(40, 98, 200, 0.55);
}

button:active {
  transform: translateY(0);
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: rgba(8, 14, 28, 0.7);
  border: 1px solid rgba(120, 180, 255, 0.4);
  border-radius: 6px;
  color: #e8f1ff;
  font-size: 15px;
  margin-bottom: 10px;
  outline: none;
}

input[type="text"]:focus {
  border-color: #4a8fff;
  box-shadow: 0 0 0 2px rgba(74, 143, 255, 0.25);
}

#topscores {
  margin-top: 22px;
  text-align: left;
}

#topscores ol {
  list-style: none;
  counter-reset: score-counter;
  font-size: 14px;
}

#topscores li {
  counter-increment: score-counter;
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(120, 180, 255, 0.1);
  color: #b6c8e6;
}

#topscores li::before {
  content: counter(score-counter) ".";
  color: #6b8bbf;
  margin-right: 8px;
  width: 20px;
  display: inline-block;
}

#topscores li .pname {
  flex: 1;
}

#topscores li .pscore {
  font-variant-numeric: tabular-nums;
  color: #e8f1ff;
}

.record {
  color: #ffd35a;
  font-weight: 600;
  margin: 8px 0 10px;
  letter-spacing: 0.06em;
}

#newRecordBox {
  margin: 14px 0;
}

#newRecordBox.hidden {
  display: none;
}

#gameover .panel p {
  color: #b6c8e6;
  margin-bottom: 14px;
}
