:root {
  --primary-color: #00ff88;
  --warn-color: #ffbf00;
  --danger-color: #ff3366;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  color: var(--primary-color);
  font-family: 'Courier New', Courier, monospace;
  height: 100%;
  cursor: crosshair;
}

#hud {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 18px;
  text-shadow: 0 0 8px var(--primary-color);
}

#counter, #streak, #lifetime {
  transition: color 0.3s ease;
  pointer-events: none;
}

#streak {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#lifetime {
  font-size: 14px;
  opacity: 0.65;
  margin-top: 0.15rem;
}

.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid var(--primary-color);
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
  cursor: help;
  pointer-events: auto;
  position: relative;
  text-shadow: none;
  user-select: none;
  transition: background 0.2s ease;
}

.help:hover, .help:focus {
  background: rgba(0, 255, 136, 0.15);
  outline: none;
}

.help-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 220px;
  padding: 0.5rem 0.65rem;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid var(--primary-color);
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.4;
  text-shadow: none;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 11;
}

.help:hover .help-tip,
.help:focus .help-tip {
  visibility: visible;
  opacity: 1;
}

#reset-btn {
  margin-top: 0.5rem;
  align-self: flex-start;
  padding: 0.3rem 0.7rem;
  font-size: 12px;
  font-family: inherit;
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 3px;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.5;
  transition: opacity 0.2s ease, background 0.2s ease;
  text-shadow: none;
}

#reset-btn:hover {
  opacity: 1;
  background: rgba(0, 255, 136, 0.1);
}

#effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
}

#ninja {
  position: absolute;
  white-space: pre;
  margin: 0;
  color: var(--primary-color);
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 0 6px currentColor;
  transition: color 0.4s ease, text-shadow 0.4s ease;
  will-change: transform;
}

#ninja.warn {
  color: var(--warn-color);
}

#ninja.danger {
  color: var(--danger-color);
  text-shadow: 0 0 12px currentColor;
}

#ninja.invisible {
  opacity: 0;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(3px, -3px); }
  75% { transform: translate(-2px, 4px); }
}

body.shake {
  animation: shake 0.25s ease-in-out;
}

.stick {
  position: absolute;
  white-space: pre;
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1;
  color: var(--primary-color);
  opacity: 0.32;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

#ninja.stunned-vis {
  animation: stun-flicker 0.2s ease-in-out infinite alternate;
}

@keyframes stun-flicker {
  from { opacity: 1; }
  to   { opacity: 0.7; }
}

.obstacle {
  position: absolute;
  white-space: pre;
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 16px;
  line-height: 1;
  color: var(--primary-color);
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
  z-index: 3;
  text-shadow: 0 0 4px currentColor;
}

#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 20;
  cursor: pointer;
}

#modal.active {
  display: flex;
}

#modal video {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 40px var(--primary-color);
}
