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

:root {
  --bg: #0b1a12;
  --panel: rgba(12, 28, 20, 0.88);
  --border: rgba(180, 220, 160, 0.22);
  --text: #f4fff0;
  --muted: #9bb89a;
  --accent: #7dcea0;
  --danger: #e74c3c;
  --carrot: #f39c12;
  --bunny: #f8f4ef;
  --bear: #8b5a2b;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--text);
  user-select: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 24px;
  gap: 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent);
}

.hud-left, .hud-right {
  min-width: 120px;
}

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

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.stat .label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.stat span:not(.label):not(.muted),
.stat {
  font-size: 22px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-weight: 600;
  font-size: 16px;
}

#danger-meter {
  width: min(280px, 40vw);
  height: 10px;
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}

#danger-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
  transition: width 0.08s linear;
}

.hint {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
}

/* Panels */
#title-screen,
#game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(125, 206, 160, 0.12), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(139, 90, 43, 0.18), transparent 50%),
    rgba(5, 14, 10, 0.72);
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.panel {
  width: min(440px, 92vw);
  padding: 36px 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.06);
  text-align: center;
}

/* Game logo: Teddy ♥ Bunny */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  margin-bottom: 14px;
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.logo-teddy {
  color: #c48a55;
  text-shadow: 0 2px 12px rgba(139, 90, 43, 0.35);
}

.logo-bunny {
  color: #f5f0e8;
  text-shadow: 0 2px 12px rgba(255, 255, 255, 0.15);
}

.logo-heart {
  color: #e74c6f;
  font-size: 0.85em;
  line-height: 1;
  transform: translateY(0.04em);
  animation: heartbeat 1.4s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(231, 76, 111, 0.45));
}

@keyframes heartbeat {
  0%, 100% { transform: translateY(0.04em) scale(1); }
  15% { transform: translateY(0.04em) scale(1.18); }
  30% { transform: translateY(0.04em) scale(1); }
  45% { transform: translateY(0.04em) scale(1.12); }
  60% { transform: translateY(0.04em) scale(1); }
}

h1 {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #b8e0c0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.tagline {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 22px;
  font-size: 15px;
}

.howto {
  list-style: none;
  text-align: left;
  margin: 0 auto 24px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: #d8ead8;
}

.howto kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 7px;
  margin: 0 2px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: #fff;
}

.btn {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 14px 36px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn.primary {
  background: linear-gradient(180deg, #8fd9a8 0%, #4caf70 100%);
  color: #0a1f12;
  box-shadow: 0 6px 0 #2d7a48, 0 10px 24px rgba(76, 175, 112, 0.35);
}

.btn.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn.primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2d7a48, 0 4px 12px rgba(76, 175, 112, 0.3);
}

.credit {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.end-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 20px 0 28px;
}

.end-stats .label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.end-stats strong {
  font-size: 28px;
  font-weight: 800;
}

#end-title.win {
  color: #7dcea0;
}

#end-title.lose {
  color: #e88a6a;
}

/* Crosshair */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 1.5px solid rgba(255,255,255,0.55);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}

/* Mobile hint */
@media (max-width: 600px) {
  .panel {
    padding: 28px 20px;
  }
  h1 {
    font-size: 1.8rem;
  }
  .howto {
    font-size: 13px;
  }
  #hud {
    padding: 12px 14px;
  }
  .stat span:not(.label):not(.muted) {
    font-size: 18px;
  }
}
