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

body {
  background: #000;
  overflow: hidden;
  font-family: 'Segoe UI', 'Courier New', monospace;
  color: #e0f0ff;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameCanvas {
  display: block;
  background: #000;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 10;
  pointer-events: none;
}

.screen.active {
  display: flex;
  pointer-events: auto;
}

.screen.overlay {
  background: rgba(0, 0, 20, 0.75);
  backdrop-filter: blur(4px);
}

.screen.overlay.active {
  display: flex;
}

.hidden {
  display: none !important;
}

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 0 20px rgba(100, 180, 255, 0.8),
    0 0 60px rgba(80, 120, 255, 0.4);
  animation: titlePulse 3s ease-in-out infinite;
}

.title-brand {
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  letter-spacing: 0.38em;
  text-indent: 0.38em;
}

.title-name {
  font-size: clamp(2.4rem, 8vw, 5rem);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  line-height: 0.95;
}

@keyframes titlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.subtitle {
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  color: rgba(180, 210, 255, 0.6);
  margin-top: -0.5rem;
}

.screen-title {
  font-size: 2.5rem;
  letter-spacing: 0.2em;
  text-shadow: 0 0 15px rgba(100, 180, 255, 0.6);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.menu-btn {
  padding: 0.85rem 2.5rem;
  font-size: 1.1rem;
  font-family: inherit;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  border: 2px solid rgba(100, 180, 255, 0.7);
  color: #c8e4ff;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 220px;
}

.menu-btn:hover {
  background: rgba(100, 180, 255, 0.15);
  border-color: #7ec8ff;
  box-shadow: 0 0 20px rgba(100, 180, 255, 0.3);
  transform: scale(1.03);
}

.menu-btn.secondary {
  border-color: rgba(150, 150, 200, 0.4);
  color: rgba(180, 200, 230, 0.8);
  font-size: 0.95rem;
}

.menu-btn.small {
  min-width: auto;
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
}

.menu-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.controls-hint {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: rgba(150, 180, 220, 0.5);
}

.controls-hint kbd,
.pause-hint kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border: 1px solid rgba(150, 180, 220, 0.3);
  border-radius: 3px;
  font-size: 0.8rem;
  margin: 0 0.1rem;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 1rem 2rem;
  z-index: 5;
  pointer-events: none;
  font-size: 1.1rem;
}

.hud-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(150, 180, 220, 0.6);
  margin-bottom: 0.2rem;
}

.hud-left, .hud-center, .hud-right {
  text-align: center;
  min-width: 80px;
}

.hud-right {
  text-align: right;
}

.leaderboard-list {
  width: min(400px, 90vw);
  max-height: 50vh;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr 5rem;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(100, 150, 255, 0.15);
  font-size: 1rem;
}

.leaderboard-row:first-child {
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.leaderboard-row .rank {
  color: rgba(150, 180, 220, 0.6);
}

.leaderboard-row .score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.empty-msg {
  color: rgba(150, 180, 220, 0.5);
  font-style: italic;
}

.final-score {
  font-size: 1.8rem;
  letter-spacing: 0.1em;
}

.high-score-badge {
  color: #ffd700;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
  animation: titlePulse 1.5s ease-in-out infinite;
}

.initials-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.initials-form input {
  width: 4rem;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  background: rgba(0, 20, 40, 0.8);
  border: 1px solid rgba(100, 180, 255, 0.5);
  color: #c8e4ff;
  outline: none;
}

.initials-form input:focus {
  border-color: #7ec8ff;
  box-shadow: 0 0 10px rgba(100, 180, 255, 0.3);
}

.pause-hint {
  color: rgba(150, 180, 220, 0.6);
  font-size: 0.9rem;
}

.jump-scare {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: #fff;
  animation: scareFlash 0.52s linear forwards;
}

@keyframes scareFlash {
  0% { background: #fff; }
  14% { background: #140000; }
  100% { background: #050000; }
}

.scare-face {
  width: min(78vmin, 560px);
  height: min(88vmin, 680px);
  background: #f3efe8;
  border-radius: 48% 48% 44% 44%;
  position: relative;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.9);
}

.scare-eye {
  position: absolute;
  top: 22%;
  width: 26%;
  height: 22%;
  background: #050505;
  border-radius: 50%;
}

.scare-eye.left { left: 15%; transform: rotate(-12deg); }
.scare-eye.right { right: 15%; transform: rotate(12deg); }

.scare-eye::after {
  content: '';
  position: absolute;
  width: 22%;
  height: 34%;
  background: #fff;
  border-radius: 50%;
  top: 18%;
  left: 28%;
}

.scare-mouth {
  position: absolute;
  left: 32%;
  right: 32%;
  bottom: 12%;
  height: 42%;
  background: #070000;
  border-radius: 42% 42% 48% 48%;
  box-shadow: inset 0 18px 28px #7a0000;
}
