@font-face {
  font-family: "CursorComic";
  src: url("./Comic Sans MS.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: "CursorComic", "Comic Sans MS", "Comic Sans", system-ui,
    -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  position: relative;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* UI overlay */

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  color: #000;
}

/* Timer (HUD only) */

#timer {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  display: none;
  pointer-events: none;
}

/* START SCREEN */

#startScreen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

/* Title with slide + trail */

#titleWrapper {
  position: relative;
  margin-bottom: 10px;
  overflow: visible;
  animation: title-slide-down 0.9s ease-out forwards;
}

#titleText {
  font-size: 34px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  text-align: center;
  position: relative;
  z-index: 2;
  text-shadow:
    0px 0px 0px rgba(0, 0, 0, 0.4),
    2px 2px 0px rgba(0, 0, 0, 0.25),
    4px 4px 0px rgba(0, 0, 0, 0.15);
}

#titleTrail {
  position: absolute;
  left: -3px;
  right: 3px;
  top: 4px;
  bottom: -4px;
  background: rgba(0, 0, 0, 0.06);
  filter: blur(4px);
  z-index: 1;
  opacity: 0;
  animation: title-trail 0.9s ease-out forwards;
  display: none;
}

/* Subtitle typing */

#subtitle {
  min-height: 1.2em;
  font-size: 16px;
  margin-bottom: 18px;
  white-space: nowrap;
}

/* Click to begin hell – blinking */

#clickToBegin {
  font-size: 20px;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}

/* Auto mode toggle */

#autoModeWrapper {
  margin-bottom: 10px;
  font-size: 14px;
}

#autoModeLabel {
  cursor: pointer;
  user-select: none;
}

#autoModeCheckbox {
  margin-right: 6px;
}

/* Hitbox mode toggle */

#hitboxModeWrapper {
  margin-bottom: 16px;
  font-size: 14px;
}

#hitboxModeLabel {
  cursor: pointer;
  user-select: none;
}

#hitboxModeCheckbox {
  margin-right: 6px;
}

#clickToBegin.blink {
  animation: blink 1s steps(2, start) infinite;
}

/* Death count on start screen */

#deathCount {
  font-size: 18px;
  margin-bottom: 18px;
  font-weight: bold;
}

/* Utility: hide start screen entirely */

.hidden-screen {
  display: none !important;
}

/* Death screen overlay */

#deathScreen {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.0);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: 15;
}

#deathScreen.active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: auto;
}

#deathScreenInner {
  text-align: center;
  padding: 10px 16px;
}

#deathTimeLabel {
  font-size: 18px;
  margin-bottom: 4px;
  text-transform: lowercase;
  font-weight: bold;
}

#deathTimeValue {
  font-size: 40px;
  margin-bottom: 4px;
  font-weight: bold;
}

#deathPlace {
  font-size: 20px;
  margin-bottom: 8px;
  font-weight: bold;
}

#deathMessage {
  font-size: 18px;
  min-height: 1.2em;
  font-weight: bold;
  margin-bottom: 6px;
}

#deathClickHint {
  font-size: 16px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.4s ease;
}

#deathClickHint.visible {
  opacity: 1;
}

/* Animations */

@keyframes title-slide-down {
  0% {
    transform: translateY(-80px);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: translateY(0px);
    opacity: 1;
  }
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
  }
}

/* When we want the start screen back without animations */

.no-anim #titleWrapper,
.no-anim #titleTrail,
.no-anim #clickToBegin {
  animation: none !important;
}